Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By silviuA
#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:
Code: Select all
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);
            }
        }
    });
}
I tried with both php 8.1 and php 7.4, same error.
Any help will be appreciated.

A Dream11 clone script is a pre-made software solu[…]

A stake clone script is a pre-designed, error-free[…]

The Aviator casino game script clone script replic[…]

The ZED RUN Clone Script by Dappsfirm replicates t[…]