VMware Cloud Community
kwonghengCS
Contributor
Contributor
Jump to solution

Help trying to post a workflow task in VRO 7.6 via Powershell

Hi all,

I have managed to perform get /vco/api/tasks succcessfully against my lab vco 7.6 and I have full admin rights. So I took the example of one of the schedule tasks, modified it and tried to create a new scheduled task based on it, but I keep getting (400) bad request. Hope someone can advise. This is an external VCO.

## assuming my $auth variable is already done

$headers = @{"Authorization"=$auth;"Content-Type"="application/json";"Accept"="application/json"}

$url = "https://myvco:8281/vco/api/tasks/"

$body = get-contect .\test.json.txt -raw

Invoke-WebRequest -Method POST -Uri $url -Headers $headers -body 

I saw in the api reference that only JSON format can be sent. Attached is the json file. I validated that the json format is correct.

vRealize Automation vRealize Orchestrator Server API - VMware API Explorer - VMware {code}

Thanks

Kelvin Wong

Labels (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
kwonghengCS
Contributor
Contributor
Jump to solution

Hi all,

Issue is resolved, tuns out that the json text files contains some hidden symbols that was not visible until I hightlight all the text. After removing the hidden symbols and also removing two of the unused parameters, it worked!

View solution in original post

Tags (1)
Reply
0 Kudos
5 Replies
eoinbyrne
Expert
Expert
Jump to solution

Have you looked in the app server log files /var/log/vco/app-server/scripting.log or server.log

There should be a more detailed error message there which should give info on why you get the 400 errror here.

Also, looking at the JSON sample you've provided, I'm not sure you can safely pass a vCACCAFE:CompositeBlueprint via the REST API - at least I've never tried that 🙂 - For complex or plugin types like those I normally just use a string parameter for the ID or name I want and then have the workflow resolve that to the correct instance type as part of it's processing

 

-HTH

xian_
Expert
Expert
Jump to solution

Where is $query set?

Reply
0 Kudos
kwonghengCS
Contributor
Contributor
Jump to solution

My bad, typo. Not $query, but $url

Reply
0 Kudos
kwonghengCS
Contributor
Contributor
Jump to solution

Let me try removing some fo the elements

Reply
0 Kudos
kwonghengCS
Contributor
Contributor
Jump to solution

Hi all,

Issue is resolved, tuns out that the json text files contains some hidden symbols that was not visible until I hightlight all the text. After removing the hidden symbols and also removing two of the unused parameters, it worked!

Tags (1)
Reply
0 Kudos