Thanks everyone for the replies.
I was able to solve this with the following lines of code in a loop; passing the incident number as a variable (INCIDENTNUM):
inc = client.post("/playbooks/execution/query_paged?include_activity_error_msg=false", {"sorts":[{"field_name":"status","type":"asc"},{"field_name":"start_time","type":"asc"}],"filters":[{"conditions":[{"method":"equals","field_name":"incident_id","value":int(INCIDENTNUM)},{"method":"equals","field_name":"playbook_type","value":"default"}]}],"start":0,"length":10})
payloadid = inc["data"][0]["id"]
client.put("/playbooks/execution/{}/status".format(payloadid), {"status":"canceled","reason":"remove it"})
This will pull the playbook id from the specific incident and then use it with the payload to remove the playbook.
------------------------------
Thanks,
Paul Formosa
------------------------------
Original Message:
Sent: Wed April 10, 2024 01:29 AM
From: Yohji Amano
Subject: Cancel Playbook
FYI
The following is my case. The API seems to work all instances to a playbook.
curl -sik -X POST -u <API-Key>:<API-Secret> -H "Content-Type: application/json" https://<soar-host>/rest/orgs/<org-id>/playbooks/execution/cancel -d @pb-cancel.json
where pb-cancel.json is as follows:
{ "playbook_handle": { "name": "<playbook-api-name>" }, "reason": "<cancel-reason>"}
response is like this.
{"number_cancelled":2}
------------------------------
Yohji Amano
Original Message:
Sent: Fri April 05, 2024 01:36 PM
From: Bo Bleckel
Subject: Cancel Playbook
Hi Paul -
There are endpoints to cancel playbooks. Check out PlaybookExecutionREST (or specifically the /orgs/{org_id}/playbooks/execution/cancel
endpoint) in the REST API reference on your SOAR instance. I don't have any experience using those endpoints, but seems to achieve what you want.
------------------------------
Bo Bleckel
Original Message:
Sent: Thu April 04, 2024 01:30 PM
From: PAUL FORMOSA
Subject: Cancel Playbook
Is there a way to cancel a playbook through the REST API? I have a list of incidents that need a playbook canceled.
------------------------------
Thanks,
Paul Formosa
------------------------------