- Mon Aug 07, 2017 6:47 am
#794253
I am trying to generate an output document using the Rest API and AJAX on a button click but when i run the below code I get an AJAX error
"ERROR!! {"error":{"code":400,"message":"Bad Request: This output document with app_doc_id: 4746131735758b0b92b3fb1043607486 does not exist!"}}"
I got all the information for the output document through the getOutputDocuments Rest API. The doc_uid below is the same as the output document that I am trying to update.
app_doc_uid 69949576459830ffeb1ae96053632593
doc_uid 4746131735758b0b92b3fb1043607486
app_doc_type OUTPUT PDF
app_doc_index 3
Here is the AJAX code I have created to call the Generate Output Document Rest API:
"ERROR!! {"error":{"code":400,"message":"Bad Request: This output document with app_doc_id: 4746131735758b0b92b3fb1043607486 does not exist!"}}"
I got all the information for the output document through the getOutputDocuments Rest API. The doc_uid below is the same as the output document that I am trying to update.
app_doc_uid 69949576459830ffeb1ae96053632593
doc_uid 4746131735758b0b92b3fb1043607486
app_doc_type OUTPUT PDF
app_doc_index 3
Here is the AJAX code I have created to call the Generate Output Document Rest API:
Code: Select all
Any help is much appreciated.function generateDocument() {
var host = PMDynaform.getHostName(); // get the hostname
var ws = PMDynaform.getWorkspaceName(); // get the current workspace
var token = PMDynaform.getAccessToken(); // get the access Token
var app_uid = $("#APP_UID").getValue();
var out_doc_uid = "4746131735758b0b92b3fb1043607486";
var delIndex = "3";
$.ajax({
url: "/api/1.0/"+ws+"/cases/"+app_uid+"/"+delIndex+"/output-document/"+out_doc_uid, // endpoint URL
data: {},
type: "POST",
beforeSend: function(xhr){xhr.setRequestHeader("Authorization", "Bearer "+token);}, // Header with the access token
success: function(xhr, status, error){
alert("SUCCESS!!"+xhr.responseText);
},
error: function(xhr, status, error){
alert("ERROR!!"+xhr.responseText);
}
});
return true;
}
$("#Submit").find("button").click(generateDocument);