Fail the first N attempts for a key, then succeed
A deterministic way to test retry logic: with succeedAfter=3, attempts 1-3 fail and attempt 4 succeeds. Every response has an X-Attempt header, and failures add Retry-After: 1. Reset the counter with DELETE /api/chaos/retry/{key}. Available for GET and POST.A deterministic way to test retry logic: with succeedAfter=3, attempts 1-3 fail and attempt 4 succeeds. Every response has an X-Attempt header, and failures add Retry-After: 1. Reset the counter with DELETE …. Available for GET and POST.
Parameters 3
| Name | Type | Description |
|---|---|---|
keyrequired | path · string | Your own counter name (up to 64 characters). Each key counts attempts independently. |
succeedAfter | query · integer (int32) | Number of attempts that fail before success (0-20, default 3). Default: 3. |
failStatus | query · integer (int32) | Status used for failures: 429, 500, 502, 503 or 504 (default 503). Default: 503. |
Responses
- 200
- This attempt succeeded.
- 400
- Invalid key, succeedAfter or failStatus.
- 503
- This attempt failed (or the chosen failStatus).
Example
curl -X GET "https://api.testingapis.com/api/chaos/retry/docs-demo?succeedAfter=0" \
-H "X-TestingApis-Key: YOUR_API_KEY"{"message": "Succeeded on attempt 1.", "attempt": 1, "succeedAfter": 0}Sign in to see the details
The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.