Receiving 400 bad request when attempting to pass the json data to a trigger a Workflow from Swagger API or Postman
search cancel

Receiving 400 bad request when attempting to pass the json data to a trigger a Workflow from Swagger API or Postman

book

Article ID: 322683

calendar_today

Updated On:

Products

VMware Aria Suite

Issue/Introduction

To be able to provide the right format in the executionContext to trigger Workflow externally via Swagger API using Workflow ID


Symptoms:

Error 400 Bad request when trying to run a workflow via API because of the JSON format in the executionContext field. 

Resolution

In order to create the executionContext payload follow the next steps.

  1. Log in to VMware Aria Automation Orchestrator.

  2. Run the desired workflow in the UI. Capture from the UI the following information:
    - executionId
    - workflowId

  3. Then create a bearer token following this article Generate Access_Token/Bearer_Token in VRA 8.x for API Authentication
  4. Run the API  /workflows/<workflowid>/executions/<executionid> using the executionId and workflowId obtained in step 2.
  5. From the response create the executionContext gathering the information related to the inputs of the workflow in order to execute the workflow with the API /workflows/<workflowid>/executions. 
    • Note: use parameters to specify the inputs of the workflow, do not use input-parameters
  6. Validate in the UI that workflow has been executed.



​​​​​​​As an example, this is the executionContext for the workflow Clone, Windows with single NIC on a lab environment:
 

{
"parameters":[
{
"value":{
"sdk-object":{
"type":"VC:VmFolder",
"href":"https://vrafqdn:443/vco/api/catalog/VC/VmFolder/vrafqdn%252Cid%253Agroup-v4/",
"id":"vrafqdn,id:group-v4"
}
},
"type":"VC:VmFolder",
"name":"folder",
"scope":"local"
},
{
"value":{
"string":{
"value":"Name of VM after cloning"
}
},
"type":"string",
"name":"name",
"scope":"local"
},
{
"value":{
"sdk-object":{
"type":"VC:VirtualMachine",
"href":"https://vrafqdn:443/vco/api/catalog/VC/VirtualMachine/vrafqdn%252Cid%253Avm-1xxx7/",
"id":"vrafqdn,id:vm-1xxx7"
}
},
"type":"VC:VirtualMachine",
"name":"vm",
"scope":"local"
},
{
"value":{
"boolean":{
"value":false
}
},
"type":"boolean",
"name":"powerOn",
"scope":"local"
},
{
"value":{
"boolean":{
"value":false
}
},
"type":"boolean",
"name":"template",
"scope":"local"
},
{
"type":"VC:Datastore",
"name":"datastore",
"scope":"local"
},
{
"type":"VC:HostSystem",
"name":"host",
"scope":"local"
},
{
"type":"VC:ResourcePool",
"name":"pool",
"scope":"local"
},
{
"value":{
"boolean":{
"value":true
}
},
"type":"boolean",
"name":"doSysprep",
"scope":"local"
},
{
"value":{
"string":{
"value":"test"
}
},
"type":"string",
"name":"clientName",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"productId",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"joinDomain",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"joinWorkgroup",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"domainAdmin",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"domainAdminPassword",
"scope":"local"
},
{
"value":{
"sdk-object":{
"type":"VC:CustomizationLicenseDataMode",
"href":"https://vrafqdn:443/vco/api/catalog/VC/CustomizationLicenseDataMode/perSeat/",
"id":"perSeat"
}
},
"type":"VC:CustomizationLicenseDataMode",
"name":"licenseMode",
"scope":"local"
},
{
"value":{
"number":{
"value":5
}
},
"type":"number",
"name":"licenseUsers",
"scope":"local"
},
{
"value":{
"string":{
"value":"Password!"
}
},
"type":"string",
"name":"newAdminPassword",
"scope":"local"
},
{
"value":{
"sdk-object":{
"type":"Enums:MSTimeZone",
"href":"https://vrafqdn:443/vco/api/catalog/Enums/MSTimeZone/130/",
"id":"130"
}
},
"type":"Enums:MSTimeZone",
"name":"inTimezone",
"scope":"local"
},
{
"value":{
"sdk-object":{
"type":"VC:Network",
"href":"https://vrafqdn:443/vco/api/catalog/VC/Network/vrafqdn%252Cid%253Advportgroup-6xx2/",
"id":"vrafqdn,id:dvportgroup-6xx2"
}
},
"type":"VC:Network",
"name":"network",
"scope":"local"
},
{
"value":{
"array":{
"elements":[
]
}
},
"type":"Array/string",
"name":"dnsServerList",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"dnsDomain",
"scope":"local"
},
{
"value":{
"boolean":{
"value":true
}
},
"type":"boolean",
"name":"dhcp",
"scope":"local"
},
{
"value":{
"array":{
"elements":[
]
}
},
"type":"Array/string",
"name":"gateway",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"ipAddress",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"macAddress",
"scope":"local"
},
{
"type":"VC:CustomizationNetBIOSMode",
"name":"netBIOS",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"primaryWINS",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"secondaryWINS",
"scope":"local"
},
{
"value":{
"string":{
"value":""
}
},
"type":"string",
"name":"subnetMask",
"scope":"local"
},
{
"value":{
"string":{
"value":"test"
}
},
"type":"string",
"name":"orgName",
"scope":"local"
},
{
"value":{
"string":{
"value":"testuser"
}
},
"type":"string",
"name":"fullName",
"scope":"local"
}]}