Hi Marc,
Yes, it is possible to retrieve output from run-script API command. It's returned being encoded to base64 inside the show-task API command response.
Getting run-script output through HTTP request
- Run run-script command (it's asynchronous) and save the task-id from the response.
- Run show-task command providing task-id that was saved in step 1. You have to run show-task command several times until response will contain status "succeeded". You have to run show-task with details-level set to "full".
- Parse show-task response and extract the base64 encoded result by following path showTaskResult.tasks[0]["task-details"][0].responseMessage
- Decode the base64 encoded result (In Javascript it can be done with atob function).
Getting run-script output through mgmt_cli tool (full example)
mgmt_cli -r true run-script script-name "list root" script "ls -l /" targets.1 "my-management" --format json 2> /dev/null \
| $CPDIR/jq/jq -r '(.tasks[0]["task-details"][0].responseMessage)' \
| base64 -di
Useful links
https://sc1.checkpoint.com/documents/R80/APIs/index.html#web/run-script
https://sc1.checkpoint.com/documents/R80/APIs/index.html#web/show-task
https://sc1.checkpoint.com/documents/R80/APIs/index.html#mgmt_cli
https://sc1.checkpoint.com/documents/R80/APIs/index.html#ws