- Mon Sep 18, 2023 5:00 am
#830908
Hi,
In 3.2.1 Community Edition i have a few processes where I use jQuery to call a REST endpoint to save some process variables (method PUT endpoint /api/1.0/{workspace}/cases/{app_uid}/variable).
I tested the same processes on Processmaker 3.5.7 CE and everithing works as expected.
Then I did a test in Processmaker 3.8.2 CE and I get a few errors, one of them is this message:
"Bad Request: You cannot open this case because of one of the following reasons: <br> You do not have permission to see this case. <br> You have not participated in this case. <br> Case is already claimed."
Here is the jQuery code that I use to call the endpoint:
Any help will be appreciated.
In 3.2.1 Community Edition i have a few processes where I use jQuery to call a REST endpoint to save some process variables (method PUT endpoint /api/1.0/{workspace}/cases/{app_uid}/variable).
I tested the same processes on Processmaker 3.5.7 CE and everithing works as expected.
Then I did a test in Processmaker 3.8.2 CE and I get a few errors, one of them is this message:
"Bad Request: You cannot open this case because of one of the following reasons: <br> You do not have permission to see this case. <br> You have not participated in this case. <br> Case is already claimed."
Here is the jQuery code that I use to call the endpoint:
Code: Select all
I tried with both php 8.1 and php 7.4, same error.var host = PMDynaform.getHostName(); //get the hostname
var ws = PMDynaform.getWorkspaceName(); //get current workspace
var token = PMDynaform.getAccessToken();
var app_uid = frames.app_uid ? frames.app_uid : ''; //get the case ID
//save Variables
function saveVars(oVars) {
$.ajax({
url: host + "/api/1.0/" + ws + "/cases/" + app_uid + "/variable", //endpoint URL
type: "PUT",
contentType: "application/x-www-form-urlencoded",
dataType: 'text',
data: oVars,
//header with the access token:
beforeSend: function(xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + token);
},
success: function(xhr, status, error) {
//do stuff..
},
error: function(xhr, status, error) {
if (xhr.responseText) {
oResponse = JSON.parse(xhr.responseText);
alert(oResponse.error.message)
} else {
alert("Error Saving! " + error);
}
}
});
}
Any help will be appreciated.