cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1094
Views
0
Helpful
5
Replies
Highlighted
Beginner

UCSD REST API Call from vRO

Hi,

I have added UCSD (as a REST host with API access key) in vRealize orchestrator and is invoking a REST host command. The workflow runs successfully in vRO, but doesnot create a new service request (as it suppose to) in UCSD for new VM creation. The worksflow script is

var operationUrl = "/app/api/rest?formatType=json&opName=userAPISubmitServiceRequest&opData=%7Bparam0:'CentOS7',param1:'BSC&vDC',param2:1,param3:-1,param4:1,param5:'Provisioning%20VM%20from%20vRA'%7D"

var requestType = "POST"

System.log("Host: " + restHost + ", operation: " + operationUrl + ", Request Type: " + requestType);

var request = restHost.createRequest(requestType, operationUrl);

request.setHeader("X-Cloupia-Request-Key","XXXXXX");

System.log("request: " + request.fullUrl);

var response = request.execute();

System.log("response: " + response.contentAsString);

result = new Properties();

result.put("statusCode", response.statusCode);

result.put("contentLength", response.contentLength);

result.put("headers", response.getAllHeaders());

result.put("contentAsString", response.contentAsString);

Here are the orchestrator workflow logs

[2018-06-22 09:22:22.673] [I] Host: DynamicWrapper (Instance) : [RESTHost]-[class com.vmware.o11n.plugin.rest.RESTHost] -- VALUE : RESTHost [name=UCSDirector, id=9b1024f4-0e50-4e01-bb73-98bad7be38dc, url=https://bscccucsd.sentinelbsc.com, connectionTimeout=30, operationTimeout=1200, hostVerification=false, proxyHost=, proxyPort=0, schemaRepo=com.vmware.o11n.plugin.rest.schema.SchemaRespository@18152643, resourceId=null, privateKeyId=null], operation: /app/api/rest?formatType=json&opName=userAPISubmitServiceRequest&opData=%7Bparam0:'CentOS7',param1:'BSC&vDC',param2:1,param3:-1,param4:1%7D, Request Type: undefined

[2018-06-22 09:22:22.675] [I] request: https://bscccucsd.sentinelbsc.com/app/api/rest?formatType=json&opName=userAPISubmitServiceRequest&opData=%7Bparam0:'CentOS7',param1:'BSC&vDC',param2:1,param3:-1,param4:1%7D

[2018-06-22 09:27:22.773] [I] response: { "serviceResponse":null, "serviceError":"SERVICE_CALL_EXCEPTION: Requested timeout", "serviceName":"InfraMgr", "opName":"userAPISubmitServiceRequest" }..

Any thoughts?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

A space/blank is a %20 not a &

I would rename your VDC or what ever you have with out spaces and special chars.

Can you make it work with the curl?

View solution in original post

5 REPLIES 5
Highlighted
Cisco Employee

Try the curl command in here first…

https://communities.cisco.com/docs/DOC-55973

I would suspect the & (BSC&vDC)in your name is the issue… also spaces in nems are usually the issue…

Highlighted

I have verified the url with Postman..no issues..Added & for a blank in vDS name..Thanks

Highlighted

A space/blank is a %20 not a &

I would rename your VDC or what ever you have with out spaces and special chars.

Can you make it work with the curl?

View solution in original post

Highlighted

Created a new vDC without special character and boom..it created a service request..Thanks for your help..

Highlighted

Awesome!

Yes I have struggled though this as well…

KISS

Keep it simply Simple

Content for Community-Ad
This widget could not be displayed.