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

Using a-synchronous commands (e.g. publish, install-policy and run-script)

Most API/CLI calls are very fast and return the requested output in a second.

On the other hand, some operations may take longer to complete. For example running a custom script may take minutes or even more.

For a developer, calling an API that takes a long and unknown time to complete, is challenging:

* The application cannot wait forever, a timeout is likely to be triggered and this might end the application with an error message.

* To improve the usability of the application, it is recommended to show some kind of progress indicator. The user should know that the application is not stuck.

* while the application is waiting, other things may happen, the application should stay responsive.

For these reasons, when calling an API that might take long to complete. We use the following technique:

Instead of waiting for the operation to complete, the API would return a response immediately. However, the response will show a "task-id" and not the actual result of the command (which at this point is still unknown).

The developer can now, call a different API (show-task) to check on the progress and output of the previous call.

This is all nice and well, but sometime you just want a simple command-line without bothering to check on its status using other commands. That's why when you call a mgmt_cli command and the server responds with a task-id, mgmt_cli will automatically call the show-task commands every few seconds until the command is no longer in-progress.

If you don't want mgmt_cli to call the show-task API automatically for you, add "--sync false" to your mgmt_cli command.

Attaching a bash script sample, that shows how to check the progress of a 'publish' command when using "--sync false"

1 Reply
Jason_Rakers
Participant

I seem to have encountered an issue using Postman where the dash "-" in "task-id" is have a valid reference.  I am trying to pass the task-id as a variable to a following request to view the status.  I posted a question for assistance here:

https://community.checkpoint.com/message/34104 

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events