Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
C_M
Contributor

Web Services API, task-id

How do I use "show-task" on Web Services API?

The documentation, shown below, isn't very helpful:

POST {{server}}/show-task
Content-Type: application/json
X-chkp-sid: {{session}}

{
  "task-id" : "2eec70e5-78a8-4bdb-9a76-cfb5601d0bcb"
}

The following code provides the task-id, but how do I then use the task-id to see the results of the task?
publish_result = api_call(r, 443,"publish", {},sid)
print("publish result: " + json.dumps(publish_result))
 
 
I would like to feed the task-id from "publish_result" or json-dumps(publish_result) into the task-id api call to then print the progress/result of the task.
 
 
0 Kudos
Reply
3 Replies
PhoneBoy
Admin
Admin

0 Kudos
Reply
C_M
Contributor

This is over Web Services, so the mgmt_cli wouldn't be relevant. Are you saying I need to write and then run another script to see the publish results via the show task-id command? I'm not familiar with "run-script"? where is that done/written?
0 Kudos
Reply
PhoneBoy
Admin
Admin

mgmt_cli is just an API client.
Anything you can do with the API can be done with mgmt_cli (and vice versa).
run-script is an example of an API call that generates a task-id that you need to parse, which the linked thread explains how to decode using the CLI:
mgmt_cli -r true show-task task-id 0490542b-e741-40b9-be65-45e1e00c9f79 details-level full --format json | $CPDIR/jq/jq -r '(.tasks[0]["task-details"][0].responseMessage)' | base64 -di

I assume something similar to the above could also be done in Python.
0 Kudos
Reply