How to trigger ‘snooze until’ from API

So I was trying to update How to trigger ‘snooze until’ from API but apparently it is closed, so for anyone interested to do it with the API (I am using pdpyras python API):
session = APISession("<your_api_token>")
incidents = session.list_all(‘incidents’, params={‘statuses[]’:[‘triggered’]})
for i in incidents:
i[‘status’] = ‘acknowledged’
i[‘duration’] = 14400 # 4 hours ‘snooze’
updated_incidents = session.rput(‘incidents’, json=incidents)

and of course you can use datetime to create a time.until_you_need_snoozed() - to put number of seconds for ‘snooze until’.

1 Like