How do I open and close an incident from a script or a deployment pipeline?
Open one with POST /api/v1/services/{slug}/incidents, keep the returned id, and close it with PATCH /api/v1/incidents/{id}/close.
Before you start
- You have an Application Programming Interface (API) key for the service.
Steps
-
Open the incident:
curl -X POST https://statusraptor.com/api/v1/services/acme-cloud/incidents \ -H "Authorization: Bearer $STATUS_RAPTOR_KEY" \ -H "Content-Type: application/json" \ -d '{"title": "Checkout is failing", "status": "CRITICAL", "message": "Investigating."}'The response contains
{"id": "<uuid>", "title": "...", "open": true}. -
Close it with the returned
id:curl -X PATCH https://statusraptor.com/api/v1/incidents/<uuid>/close \ -H "Authorization: Bearer $STATUS_RAPTOR_KEY"
Questions
Why does the status have to be upper case here?
For incidents, status must be the exact upper-case name, for example CRITICAL.
What does closing do?
The same as in the back office: Status Raptor posts "Resolved" updates and sends the incident closed email.