05-11-2018 09:32 AM - edited 03-01-2019 06:27 AM
Does anyone have a working example of a curl call to UCS Director REST API. Requests using the REST API browser seem to work but I have yet to replicate that on the command line. No amount of escaping seems to work. Neither GET nor POST etc etc.
Anyone?
curl -X GET -v -k -H 'X-Cloupia-Request-Key: 96E0734017714BF48408EC3C4A8672D3' 'https://192.168.241.252/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData=\{param0:"InvokeCustTask",param1:\{"list":\[\{"name":"First Input","value":"Another"\},\{"name":"Second Input","value":"User"\}\]\},param2:-1\}'
...
> GET /app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData={param0:"InvokeCustTask",param1:{"list":[{"name":"First Input","value":"Another"},{"name":"Second Input","value":"User"}]},param2:-1} HTTP/1.1
...
< HTTP/1.1 400 Bad Request
< Transfer-Encoding: chunked
< Date: Fri, 11 May 2018 16:27:51 GMT
< Connection: close
* Server Web is not blacklisted
< Server: Web
Solved! Go to Solution.
05-11-2018 12:28 PM
Are you replacing spaces with %20‘s and so on?
05-11-2018 12:28 PM
Are you replacing spaces with %20‘s and so on?
05-11-2018 12:54 PM
Email reply didnt make it so here it is:
Started this message saying yes I escaped spaces etc but realized that “ need to become %22 etc. So yeah it’s working now. Also figured out the UCSM account name by looking at old manual runs and the output.
So for posterity here is the result (missing the other arguments to the workflow I have to add now that it is working):
curl -X POST -v --stderr - -k -x socks6h://localhost:8080 -H "X-Cloupia-Request-Key: 96E0734017714BF48408EC3C4A8672D3" 'https://192.168.242.252/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData=\{%22param0%22:%22Cisco%20UCS%20Configure%20iSCSI%20Boot%20Info%22,%22param1%22:\{%22list%22:\[\{%22name%22:%22UCSM%20Account%22,%22value%22:%22INF...'
Thanks!
-s
05-11-2018 12:54 PM
Started this message saying yes I escaped spaces etc but realized that “ need to become %22 etc. So yeah it’s working now. Also figured out the UCSM account name by looking at old manual runs and the output.
So for posterity here is the result (missing the other arguments to the workflow I have to add now that it is working):
curl -X POST -v --stderr - -k -x socks6h://localhost:8080 -H "X-Cloupia-Request-Key: 96E0734017714BF48408EC3C4A8672D3" 'https://192.168.242.252/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData=\{%22param0%22:%22Cisco%20UCS%20Configure%20iSCSI%20Boot%20Info%22,%22param1%22:\{%22list%22:\[\{%22name%22:%22UCSM%20Account%22,%22value%22:%22INFRA@admin%22\}\]\},%22param2%22:-1\}'
Thanks!
-s
05-11-2018 01:01 PM
Some times it is better tonnage the workflow a compound task and call a wrapper work flow tHat doe not have spaces and special chars.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide