VMware Cloud Community
PushkarAnupam
Contributor
Contributor

vRO 8.1 Cannot execute the request

I am using Veeam REST API.

When i am running the action normally,  I am getting the output in array.  

when I am running from Dynamic custom form. Its giving error "Cannot execute the request. "

when I am using simple Array based action without REST API call. its giving the output in the Dynamic custom form. 

No sure how track the logs , can some one please help 🙂 .

0 Kudos
3 Replies
iiliev
VMware Employee
VMware Employee

How do you call Veeam REST API? Using vRO REST plug-in scripting API?

Could you export and attach a package with sample action / workflow that demonstrates the problem so we can use it to reproduce the error locally?

0 Kudos
PushkarAnupam
Contributor
Contributor

below is the code what i use




 
//Connnect to Backup and Replication Server
var PostResponse = BRHost.createRequest("POST", "/api/sessionMngr/", null).execute();
//System.log("Connection Successful: " + PostResponse.contentAsString)
var sessionHeader = PostResponse.getHeaderValues("X-RestSvcSessionId")
System.log("X-RestSvcSessionId:" + sessionHeader);
//GET list of Backups
var backupListXML = BRHost.createRequest("GET", "api/jobs?type=job", null);
System.log("Backup Jobs " + backupListXML.contentAsString);
backupListXML.setHeader("x-restsvcsessionid",sessionHeader[0]);
 
var backupListXML = backupListXML.execute();
statusCode = backupListXML.statusCode;
 
if ( statusCode != 200 ) {
throw "HTTPError: status code: " + statusCode;
}
//System.log(backupListXML);
backupListXML = backupListXML.contentAsString
//System.log(backupListXML);
 
var document = XMLManager.fromString(backupListXML);
if (!document) {
errorCode = "Invalid XML Document";
throw "Invalid XML Document";
}
 
//Get References
var referenceElementList = document.getElementsByTagName("Ref");
var numOfReferences = referenceElementList.length
 
//System.log("number of References : " + numOfReferences);
if (numOfReferences == 0) {
errorCode = "Invalid XML Document - name element missing";
throw "Invalid XML Document";
}
 
//Get Attributes of References
for (var i = 0; i < numOfReferences; i++) {
var ref = referenceElementList.item(i);
//Get attributes of each of the references
//Create Array
var refAttributes = ref.attributes;
 
//Add attributes to the Array and Log each Job
var Name = ref.getAttribute("Name");
System.log("Backup Job Name is : " + Name);
var UID = ref.getAttribute("UID");
System.log("UID is : " + UID);
 
if (Name == jobName) {
//Format UID to be usable
UID = UID.replace("urn:veeam:Job:", "");
desiredJobUID = UID;
}
 
}
 
System.log("DesiredJobUID is : " + desiredJobUID);
return desiredJobUID;
 
0 Kudos
PushkarAnupam
Contributor
Contributor

Using vRO REST plug-in scripting API? Yes

 

In 8.1, I am using custom form. Its in Serivce Broker> content.

`I am defining in drop down for list of all backup options  for users to choose.

While defining the link to vRO action it ask for the REST API server to use.

Let me see if i can record and upload in youtube with the issue.

0 Kudos