Hello,
I might share with you a bash script I wrote to retrieve the most recent 1000 completed executions of a playbook, then processes the output to extract end time and elapsed seconds for the executions. I suspect that it would illustrate how I went about doing so, against the REST API.
Of necessity it uses an API key to access the REST API. The key needs permissions as follows:
- Incident permissions: read
- Playbook permissons: read
- Other Permissions: Read Incident Action Invocations
The parameters are:
- Base URL
- API key
- API secret
- Organisation ID
- Playboook name
Here's an example of using it.
$ ./getExecutionTime.sh http://localhost:8080 b6885ab2-e6a8-4a26-969d-7fc15f74082c SOQq-IUouG-J1J1vCUs5x0Dgwqd5iTcncNeV-5291S8 201 "Just script"
{
"instance": 5,
"end_time": "2024 11 19 13:05:52 IST",
"elapsed_time_seconds": 0.269
}
{
"instance": 4,
"end_time": "2024 11 19 13:05:50 IST",
"elapsed_time_seconds": 0.153
}
{
"instance": 3,
"end_time": "2024 11 19 13:05:49 IST",
"elapsed_time_seconds": 0.164
}
{
"instance": 2,
"end_time": "2024 11 19 13:05:38 IST",
"elapsed_time_seconds": 0.159
}
{
"instance": 1,
"end_time": "2024 11 19 10:27:46 IST",
"elapsed_time_seconds": 0.394
}