A network error after a POST leaves you not knowing whether the resource was created. Send an Idempotency-Key with creating requests, and retry with the same key:
curl -fsS https://app.monitorly.cloud/api/v1/projects/$PROJECT/checks \ -H "Authorization: Bearer $MONITORLY_TOKEN" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 4f1d2c8e-deploy-1842" \ --data @check.json- The key is 1 to 255 characters of your choice; a UUID per intended action works well.
- A repeat with the same key and the same request returns the stored response, status and body, and creates nothing.
- The same key with another method, path or body answers
422 request.idempotency_key_reused. - Keys are kept for 24 hours.
- An empty or too long key answers
400 request.idempotency_key_invalid.
Which operations take it
Section titled “Which operations take it”| Operation | Request |
|---|---|
| Create a workspace | POST /api/v1/workspaces |
| Create a project | POST /api/v1/workspaces/{workspaceId}/projects |
| Create a check | POST /api/v1/projects/{projectId}/checks |
| Create a maintenance window | POST /api/v1/projects/{projectId}/maintenance |
| Create a status page | POST /api/v1/projects/{projectId}/status-pages |
| Post an incident | POST /api/v1/status-pages/{pageId}/incidents |
| Add an update to a post | POST /api/v1/page-incidents/{incidentId}/updates |
| Create an escalation policy | POST /api/v1/workspaces/{workspaceId}/escalation-policies |
| Invite a member | POST /api/v1/workspaces/{workspaceId}/invites |
| Create an API token | POST /api/v1/workspaces/{workspaceId}/api-tokens |
Other creating requests ignore the header. Alert channels refuse a second channel to the same address with 409 alert_channel.duplicate; a config apply is safe to retry as it is: applying the same plan again answers the result of its first apply; join tokens, link codes, test runs and exports are new on every call.