Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: amosbatto

User avatar
By jemiris
#826178
Hi,

Is there any way to get the process map and its properties via rest API
The attached image below:
processmap-rest.png
processmap-rest.png (68.81 KiB) Viewed 318 times
User avatar
By amosbatto
#826188
Install my extraRest plugin. Then call GET extrarest/session-id to get the session ID.

Then, you can create a <iframe> whose src is set to the URL:
http://{domain_or_ip}/sys{workspace}/{lang}/{skin}/designer?prj_uid={process_uid}&prj_readonly=true&app_uid={app_uid}&sid={session_id}

Example:
Code: Select all
<iframe src="http://example.com/sysworkflow/en/neoclassic/designer?prj_uid=6135378175a8dcdca9a2641037096319&prj_readonly=true&app_uid=9777918985a8dddbf884236088281261&sid=1234567890abcde1234567890abcde"></iframe>
User avatar
By jemiris
#826199
That's a great answer. Thanks and I have another question that if the session gets expired how can I get another session-id.
I need some clarifications on that. Could you please explain it?
User avatar
By jemiris
#826236
Thanks a lot.
My Questions:
1. How does the endpoint know that when the session get's expiry in the processmaker?
2. As of now, we are mentioning the session-id for any user. So how the rest API gets the session-id?
3. Is it getting the session id of the admin user or how is it getting?
4. Why I have these questions it's because in the web service name called "Automatic Login" https://wiki.processmaker.com/index.php ... atic_Login. In web services, we have to specify the username and password to get the particular user's session id. So my question is how the REST API will the particular user id?
User avatar
By amosbatto
#826249
jemiris wrote: Thu Aug 29, 2019 5:07 am 1. How does the endpoint know that when the session get's expiry in the processmaker?
If the login session has expired (after 24 minutes of inactivity), then when you try to open the process map in an iframe, it will be redirected to the ProcessMaker login screen. The user can login, and then the iframe will redirect back to the process map.
If you want to avoid making the user login manually, then you should call a REST endpoint just to verify that the login session is still valid, before trying to display the process map in an iframe. If the call to the REST endpoint fails, then you need login using oAuth2 and then get a new session ID. Then, use that new session ID to display the process map in an iframe.
jemiris wrote: Thu Aug 29, 2019 5:07 am 2. As of now, we are mentioning the session-id for any user. So how the rest API gets the session-id?
3. Is it getting the session id of the admin user or how is it getting?
You can only get the session ID for the user who logged in using oAuth2. If you logged in as "admin", then you are getting the session ID for "admin". You can't get session IDs for other users.

If you want to do actions for other users, then the extraRest plugin has endpoints for Process Supervisors to do actions like route cases, assign cases, set variables, etc. for other users.
jemiris wrote: Thu Aug 29, 2019 5:07 am 4. Why I have these questions it's because in the web service name called "Automatic Login" https://wiki.processmaker.com/index.php ... atic_Login. In web services, we have to specify the username and password to get the particular user's session id. So my question is how the REST API will the particular user id?
That example from the web services documentation is attaching the session ID to the URL, just like I'm telling you to do with REST.

Web services is the same as REST. You need to login as each user to get his/her session ID.
User avatar
By amosbatto
#826476
I don't know of an easy way. You would have to read the info from the database to draw the map.
Task doesnt have any users.

I have created a small process. Users are assigned[…]

NEW MOBILE APP ISSUE

Just trying to setup to use the mobile App with my[…]

It's really a great idea. I have followed the seco[…]

yes i use php thanks for the information