I have a hybrid mail application which I want to submit files with a POST command and also issue a POST command to see how many items are queued up. I have very limited experience in calling API’s but someone has tested the API and said they can connect and issue the command:
You’ll have to use a script for that. Here’s a basic version that issues a POST request and writes the response to the current job file (thereby replacing it) in Workflow:
// Initialize a few objects
var xhr = new ActiveXObject("Microsoft.XMLHTTP");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var payload = {
"statuses": ["DRAFT", "HANDLED", "ERROR", "REJECTED", "PENDING_VALIDATION", "PENDING_COLLECTION", "PENDING_DELIVERY"],
"username": "admin"
}
// specify the proper URL for the API call
xhr.open("POST", "http://someUrl.example.com/ApiEndpoint", false);
// send the payload object
xhr.send(JSON.stringify(payload));
// check if the call was successful
if(xhr.status==200) {
res = xhr.responseText;
// Overwrite Workflow's Job file with the response from the API call
var myFile = fso.CreateTextFile(Watch.GetJobFileName());
myFile.Write(res);
myFile.Close();
}
You’ll probably have to tweak this a little, but it should get you going.