cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1574
Views
0
Helpful
5
Replies

UCSD REST API Call from vRO

surengoel
Beginner
Beginner

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

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

Orf Gelbrich
Cisco Employee
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…

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

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?

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

Awesome!

Yes I have struggled though this as well…

KISS

Keep it simply Simple

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers