Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2023-05-08 03:26 PM
I have tried to click workflow action button using REST API call with below code from browser console. but it is throwing 405 error(method not allowed) or 403 error(forbidden) when I tried with different verb PUT.
If I try to click the button from REST API console in Archer API template application, then REST API call with POST verb is getting successful.
var xhr = new XMLHttpRequest();
var json_body = {
"ContentId": 123456,
"CompletionCode": 1
"WorkflowNodeId": "12345:CUST"
}
json_body = JSON.stringify(json_body);
xhr = new XMLHttpRequest();
xhr.open('POST',""+BaseURL +"/api/core/system/WorkflowAction", true);
xhr.setRequestHeader("Accept", "*/*");
xhr.setRequestHeader("Authorization", "Archer session-id="+ session);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify(json_body));
xhr.onreadystatechange = function ()
{
if(xhr.readyState == 4)
{
console.log("Processing Request");
if(xhr.status==200)
{
console.log("Workflow button is clicked");
}
else
{
console.log(xhr.status);
}
}
}
Is there something that I missed in the REST API call?
2023-05-11 01:49 PM
I blurred that part in my previous screenshot. Please look at this original one
2023-05-11 02:15 PM
Thanks, I missed that part in your other post ; (
Try sending this as a header:
'x-csrf-token': (window.sessionStorage) ? window.sessionStorage.getItem("x-csrf-token") : parent.parent.ArcherApp.globals['xCsrfToken']
Advisory Consultant
2023-05-11 04:06 PM
Hi David,
I was able to push a single record to the next node in AWF using the POST /api/core/system/WorkflowAction using the JSON body
2023-05-11 04:59 PM
@bohljeff unfortunately, the API only takes one Content ID at a time.
Advisory Consultant
2023-05-12 01:00 PM
@DavidPetty Thank you, It is working when I pass X - CSRF session token to the header. May I know why it was not working when I passed user session token to the header in my POST request?
2023-05-13 09:06 AM
It's for CSRF protection.
Advisory Consultant