Posted 12/05/2024
RFC 9457 - Problem Details for HTTP APIs. The document defines a “problem detail” to carry machine-readable details of errors in HTTP response content to avoid the need to define new error response formats for HTTP APIs.
JSON: application/problem+json XML: application/problem+xml
Custom properties can be added to the problem object but must follow naming conventions (e.g., start with a letter and use alphanumeric characters or _).
Use resolvable URIs for type and instance when possible. Avoid exposing sensitive details (e.g., stack traces) in error responses. Ensure title, status, and other fields provide clarity without requiring type dereferencing. Ensure proper validation of any additional fields.
{
"type": "https://example.com/probs/not-found",
"title": "Resource Not Found",
"status": 404,
"detail": "The requested resource does not exist.",
"instance": "/api/resource/123"
}