Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Query vCO workflow using REST API from PowerShell

$
0
0

Hello,

 

I am trying to query a vCO workflow by name using the REST API from PowerShell based on this article:

 

http://www.vcoteam.info/articles/learn-vco/268-how-to-use-the-rest-api-to-start-a-workflow.html

 

$username = 'XXXXXX'

$upassword = 'XXXXXX'

$auth = $username + ':' + $upassword

$Encoded = [System.Text.Encoding]::UTF8.GetBytes($auth)

$EncodedPassword = [System.Convert]::ToBase64String($Encoded)

$headers = @{"Authorization"="Basic $($EncodedPassword)";}

$body = "<execution-context xmlns='http://www.vmware.com/vco'></execution-context>"

#query for workflow named "donothing"

Invoke-RestMethod -uri https://XXXX:8281/api/workflows/?conditions=name=donothing -Headers $headers -Body $body -ContentType "application/xml" -Method Get

 

Invoke-RestMethod : Cannot send a content-body with this verb-type.

At line:1 char:1

+ Invoke-RestMethod -uri https://XXXX:8281/api/workflows/?conditions=name=donoth ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Invoke-RestMethod], ProtocolViolationException

    + FullyQualifiedErrorId : System.Net.ProtocolViolationException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

The query succeeds using the REST client on Firefox, but I cannot get it to work on PowerShell. (NOTE: execution of workflows from PowerShell works fine)

 

Any help is appreciated.

 

Thanks,

 

Juan.


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>