Problem details

RFC 7807-shaped error bodies for validation and conflict flows. Load a template into the create form, then adjust the response before creating an endpoint.

422application/jsonPOST

Validation problem

Test form and API validation states with a problem-details body.

Keeps the content type within Stubpoint's allowed JSON type while using the RFC 7807 shape.

Use template
View payload and cURL

Headers

none

Body

{
  "type": "https://stubpoint.dev/problems/validation",
  "title": "Validation failed",
  "status": 422,
  "detail": "One or more fields need attention.",
  "errors": {
    "email": [
      "Enter a valid email address."
    ],
    "quantity": [
      "Quantity must be at least 1."
    ]
  }
}

Create with cURL

curl -i 'https://stubpoint.dev/api/endpoints' -H 'Content-Type: application/json' -d '{
  "body": "{\n  \"type\": \"https://stubpoint.dev/problems/validation\",\n  \"title\": \"Validation failed\",\n  \"status\": 422,\n  \"detail\": \"One or more fields need attention.\",\n  \"errors\": {\n    \"email\": [\"Enter a valid email address.\"],\n    \"quantity\": [\"Quantity must be at least 1.\"]\n  }\n}",
  "content_type": "application/json",
  "headers": null,
  "methods": [
    "POST"
  ],
  "status": 422
}'
409application/jsonPOST

Conflict problem

Check how duplicate submissions or idempotency conflicts appear.

Use template
View payload and cURL

Headers

none

Body

{
  "type": "https://stubpoint.dev/problems/conflict",
  "title": "Request conflict",
  "status": 409,
  "detail": "A matching request has already been accepted."
}

Create with cURL

curl -i 'https://stubpoint.dev/api/endpoints' -H 'Content-Type: application/json' -d '{
  "body": "{\n  \"type\": \"https://stubpoint.dev/problems/conflict\",\n  \"title\": \"Request conflict\",\n  \"status\": 409,\n  \"detail\": \"A matching request has already been accepted.\"\n}",
  "content_type": "application/json",
  "headers": null,
  "methods": [
    "POST"
  ],
  "status": 409
}'
400application/jsonPOST

Malformed request problem

Test client handling for unreadable or malformed request bodies.

Use template
View payload and cURL

Headers

none

Body

{
  "type": "https://stubpoint.dev/problems/bad-request",
  "title": "Bad request",
  "status": 400,
  "detail": "The request body could not be read.",
  "instance": "/requests/req_test_123"
}

Create with cURL

curl -i 'https://stubpoint.dev/api/endpoints' -H 'Content-Type: application/json' -d '{
  "body": "{\n  \"type\": \"https://stubpoint.dev/problems/bad-request\",\n  \"title\": \"Bad request\",\n  \"status\": 400,\n  \"detail\": \"The request body could not be read.\",\n  \"instance\": \"/requests/req_test_123\"\n}",
  "content_type": "application/json",
  "headers": null,
  "methods": [
    "POST"
  ],
  "status": 400
}'
429application/jsonGET, POST

Rate limit problem

Check rate-limit error handling with a Retry-After header.

Use template
View payload and cURL

Headers

{
  "Retry-After": "30"
}

Body

{
  "type": "https://stubpoint.dev/problems/rate-limit",
  "title": "Too many requests",
  "status": 429,
  "detail": "Slow down and retry shortly."
}

Create with cURL

curl -i 'https://stubpoint.dev/api/endpoints' -H 'Content-Type: application/json' -d '{
  "body": "{\n  \"type\": \"https://stubpoint.dev/problems/rate-limit\",\n  \"title\": \"Too many requests\",\n  \"status\": 429,\n  \"detail\": \"Slow down and retry shortly.\"\n}",
  "content_type": "application/json",
  "headers": {
    "Retry-After": "30"
  },
  "methods": [
    "GET",
    "POST"
  ],
  "status": 429
}'

Other recipe shelves