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.
#814486
Hi!
I'm currently working on the route-case API and having some problems. I have a simple process and assigned my own user account which has an admin role. When I try to use the route-case api /cases/{app_uid}/route-case or the rest light route api api/1.0/{workspace}/light/cases/{app_uid}/route-case using POSTMAN, I am encountering the { "error": { "code": 400, "message": "Bad Request: This case is assigned to another user" } } . I tried to access the case information using the /cases/{app_uid} but it also returns an error { "error": { "code": 400, "message": "Bad Request: You do not have permission to see this case or you have not participated in it." } } . But when I try the rest light api /api/1.0/{workspace}/light/participated/case/{app_uid} it return the details of the case together with the task assigned to my account.
Any help would be greatly appreciated! Thank you.
light.png
light.png (95.52 KiB) Viewed 6231 times
light2.png
light2.png (48.01 KiB) Viewed 6231 times
#814495
amosbatto wrote:I have created a REST endpoint that you can use to get around this problem:
https://sourceforge.net/p/pmcommunity/c ... route-case

Install version 1.5 of the extraRest plugin and then users who are Supervisors to the case's process can route cases assigned to other users.
Thank you for the reply. The extrarest case info api is working, but I still have a problem when I access the extrarest route case api. Did I miss something?
extrarest case info api
extrarest1.png
extrarest1.png (65.72 KiB) Viewed 6221 times
extrarest route case api
extrarest2.png
extrarest2.png (42.42 KiB) Viewed 6221 times
#814507
amosbatto wrote:Oh sorry about that. I changed /cases/{app_uid} to /case/{app_uid} at the last minute to match the other endpoint, but I forgot to change it in the source code. I have uploaded a new version of 1.5. Delete the extraRest plugin that you have installed and import the new version on sourceforge.
Thank you for the update. I'm still getting an error "message": "Bad Request: Logged-in user ' ' must be assigned as a Supervisor for process '1637958345af150ea660134054779395'." . Even if the user assigned from the task is the same as the user I used to have an access token. I also tried to set the same user as the supervisor but the error is still the same. :cry:
Thank you.
supervisor assignment
supervisor.png
supervisor.png (98.07 KiB) Viewed 6212 times
error message
bad request.png
bad request.png (54.36 KiB) Viewed 6212 times
#814517
From the error message, it looks like the endpoint's code isn't able to get the ID of the logged-in user. What version of PM do you have installed? Bitnami or manual install? What operating system and what version of PHP?

OK, let's debug it. In the file /workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php, line 887, change the code from:
Code: Select all
            $loggedUserUid = $this->getUserId();
to:
Code: Select all
            $loggedUserUid = $this->getUserId();
            return "logged=".$loggedUserUid.'|';
Then, run the endpoint again and see if you see the logged-in user's ID in the response in POSTMAN.
#814542
amosbatto wrote: Wed May 23, 2018 9:37 pm From the error message, it looks like the endpoint's code isn't able to get the ID of the logged-in user. What version of PM do you have installed? Bitnami or manual install? What operating system and what version of PHP?

OK, let's debug it. In the file /workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php, line 887, change the code from:
Code: Select all
            $loggedUserUid = $this->getUserId();
to:
Code: Select all
            $loggedUserUid = $this->getUserId();
            return "logged=".$loggedUserUid.'|';
Then, run the endpoint again and see if you see the logged-in user's ID in the response in POSTMAN.
Hello,
Attached below the PM details and php version. The result of logged user is empty.
PM Details
info.png
info.png (84.69 KiB) Viewed 6175 times
Return result
log.png
log.png (23.24 KiB) Viewed 6175 times
#814577
There is no other way of doing this except to create your own custom REST endpoint (and that won't work if $this->getUserId() isn't working) or writing directly to the APPLICATION and APP_DELEGATION tables in the database. However, please answer my original question. Is this a manual install or is this a Bitnami installation?

Also post the contents of your /workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php file so I can examine it. Either it is screwed up or there is something wrong with your installation.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]