Hi all,
I am integrating with "Jira API's" I am using the vRO REST plugin.
All works well to do a GET or even a POST for JIRA Issues.
When I put my vRO action on a workflow to do a GET and return the string "Valid Jira Story" if the Issue number exists, it works with the 'userIssue' as an INPUT parameter, and RESTOperation set.
So whats the problem you ask?
When I add the action to a Custom Form, I have the RESTOperation set for the GET, and have a text field setup for the input parameter 'userIssue" but it fails, with the Error:
The script is:
Any help is appreciated thanks.
The error log says your input restOp was null. But you cannot select your RESTOperation in the custom form as an input. So I suggest to remove it from the inputs and search for the operation within the action itself:
var restHosts = RESTHostManager.getHosts();
var restHost;
var restOp;
for each (hostID in restHosts) {
var host = RESTHostManager.getHost(hostID);
if (host.name == "jira") {
restHost = host;
break;
}
}
var ops = restHost.getOperations();
for each (opID in ops) {
var op = restHost.getOperation(opID);
if (op.name == "myOp") {
restOp = op;
break
}
}
Another method is to hard-code the IDs instead of the names.
The error log says your input restOp was null. But you cannot select your RESTOperation in the custom form as an input. So I suggest to remove it from the inputs and search for the operation within the action itself:
var restHosts = RESTHostManager.getHosts();
var restHost;
var restOp;
for each (hostID in restHosts) {
var host = RESTHostManager.getHost(hostID);
if (host.name == "jira") {
restHost = host;
break;
}
}
var ops = restHost.getOperations();
for each (opID in ops) {
var op = restHost.getOperation(opID);
if (op.name == "myOp") {
restOp = op;
break
}
}
Another method is to hard-code the IDs instead of the names.
Thanks
Your answer gave me enough to get this working.
I have also removed the "userIssue" param on the restoperation, and instead set the urlTemplate in the code with the input param instead as per below, this stops the action failing while the input is null.
restOp.urlTemplate = "/rest/api/2/issue/"+userIssue
Thanks again
Jono.