0

I recently discovered I could configure a script in ProcessMaker 4 to be accessed directly using a GET or POST request. I do not see anything in the documentation about passing in data. Is it possible to pass in some data via url params or the post body to be used in the script? If so, how do I access that data within a PHP script?

Example request: https://example.elluciancloud.com/api/1.0/execution/script/123435678?username=johnny5

Example script:

<?php

$userName = $data['username'];

// do something with the userName
  • Please review the api documentation, execute script section: [https://yourhost/api/documentation#/Scripts/executeScript](https://yourhost/api/documentation#/Scripts/executeScript) [Img1](https://i.stack.imgur.com/ujprx.png) [Img2](https://i.stack.imgur.com/t5Ib7.png) – Ronald Nina May 08 '23 at 19:41
  • Thanks @RonaldFranzNinaLayme. The images were helpful and once I added the params correctly in Postman, I was able to get it working. – Brian Hart May 10 '23 at 22:36

1 Answers1

0

Please review the api documentation in your environment, go to the script section, and select method post, script/execute/{script_id} For example your url would be: https://yourhost/api/documentation#/Scripts/executeScript in this section you must place the id of the script and body content in json format, the variables accept are config and data: Img1

In the script you can receive those two variables sent in the body

Img2

Moritz Ringler
  • 9,772
  • 9
  • 21
  • 34