RFC 9457
Problem Details for HTTP APIs
Problem Details for HTTP APIs π
Okay bestie, so this spec is RFC 9457 β¨, and it's called "Problem Details for HTTP APIs." It was written by M. Nottingham, E. Wilde, and S. Dalal π. It's a Standards Track document (so it's the real deal π), it was published in July 2023, and its ISSN is 2070-1721. The title block only lists what it obsoletes: RFC 7807, which this one officially replaces π .
Abstract
Here's the big idea π¦: a "problem detail" carries machine-readable error details inside HTTP response content, so HTTP APIs don't have to invent a brand-new error format every single time. This document obsoletes RFC 7807.
Status of This Memo
This is an Internet Standards Track document π₯.
It's a product of the Internet Engineering Task Force (IETF), which means it represents the consensus of the IETF community. It went through public review and got approved for publication by the Internet Engineering Steering Group (IESG) π«Ά. If you want more info on Internet Standards, check out Section 2 of RFC 7841.
For the current status of this document, any errata, and how to send feedback, go to https://www.rfc-editor.org/info/rfc9457 πΈ.
Copyright Notice
Copyright (c) 2023 IETF Trust and the persons identified as the document authors. All rights reserved π.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as they stand on the date this document was published. Please actually read these, because they spell out your rights and restrictions for this document π. Code Components pulled out of this document must include Revised BSD License text, as described in Section 4.e of the Trust Legal Provisions, and they come with no warranty, as the Revised BSD License describes π.
Table of Contents
1. Introduction
2. Requirements Language
3. The Problem Details JSON Object
3.1. Members of a Problem Details Object
3.1.1. "type"
3.1.2. "status"
3.1.3. "title"
3.1.4. "detail"
3.1.5. "instance"
3.2. Extension Members
4. Defining New Problem Types
4.1. Example
4.2. Registered Problem Types
4.2.1. about:blank
5. Security Considerations
6. IANA Considerations
7. References
7.1. Normative References
7.2. Informative References
Appendix A. JSON Schema for HTTP Problems
Appendix B. HTTP Problems and XML
Appendix C. Using Problem Details with Other Formats
Appendix D. Changes from RFC 7807
Acknowledgements
Authors' Addresses
1. Introduction β¨
HTTP status codes (Section 15 of [HTTP]) can't always say enough about an error to be useful π. Humans in web browsers can usually make sense of an HTML [HTML5] response, but non-human consumers of HTTP APIs struggle with that.
So this spec defines simple JSON [JSON] and XML [XML] document formats that describe the specifics of a problem you ran into. These are called "problem details" π .
Here's an example. Say a response is telling the client that their account doesn't have enough credit πΈ. The API designer might pick the 403 Forbidden status code so generic HTTP software (like client libraries, caches, and proxies) knows the general vibe of the response. The API-specific problem details (like why the server refused the request and what the account balance is) get carried in the response content, so the client can act on them properly. For instance, it could trigger a transfer of more credit into the account π.
This spec names each specific "problem type" (like "out of credit") with a URI [URI]. HTTP APIs can use URIs they control to identify their own problems, or reuse existing ones for interoperability and common semantics. Check out Section 4.2 for more on that π¦.
Problem details can also include other info, like a URI identifying the problem's specific occurrence (basically giving an ID to the concept "The time Joe didn't have enough credit last Thursday"). That's super useful for support or forensic purposes π.
The data model for problem details is a JSON [JSON] object. When you serialize it as a JSON document, it uses the "application/problem+json" media type. Appendix B defines an equivalent XML format, which uses the "application/problem+xml" media type πΈ.
When problem details are sent in an HTTP response, the contents can be negotiated using proactive negotiation (see Section 12.1 of [HTTP]). In particular, the language for human-readable strings (like those in title and description) can be negotiated with the Accept-Language request header field (Section 12.5.4 of [HTTP]). Heads up, though: that negotiation can still end up returning a non-preferred, default representation π.
Problem details work with any HTTP status code, but they fit 4xx and 5xx responses most naturally π. Problem details are (naturally) not the only way to convey the details of a problem in HTTP. If the response is still a representation of a resource, for example, it's often better to describe the relevant details in that application's own format. And plenty of defined HTTP status codes cover situations where no extra detail is needed π§.
The goal of this spec is to give applications that need an error format a common one, so they don't have to define their own, or get tempted to redefine what existing HTTP status codes mean π. Even if an application doesn't use it to convey errors, reviewing its design can still help with the decisions you face when conveying errors in an existing format π.
See Appendix D for a list of changes from [RFC7807] π.
2. Requirements Language π
Here's the BCP 14 rulebook, so you know exactly how strong each word is π₯. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
3. The Problem Details JSON Object π
The canonical model for problem details is a JSON [JSON] object. When it's serialized in a JSON document, that format is identified with the "application/problem+json" media type π.
Here's what it looks like in action:
POST /purchase HTTP/1.1
Host: store.example.com
Content-Type: application/json
Accept: application/json, application/problem+json
{
"item": 123456,
"quantity": 2
}
HTTP/1.1 403 Forbidden
Content-Type: application/problem+json
Content-Language: en
{
"type": "https://example.com/probs/out-of-credit",
"title": "You do not have enough credit.",
"detail": "Your current balance is 30, but that costs 50.",
"instance": "/account/12345/msgs/abc",
"balance": 30,
"accounts": ["/account/12345",
"/account/67890"]
}
So here, the out-of-credit problem (identified by its type) explains the 403 in "title" πΈ. The "instance" member pins down the specific problem occurrence, and "detail" gives occurrence-specific details. It also adds two extensions: "balance" shows the account's balance, and "accounts" lists links where the account can be topped up π«Ά.
When an API is set up for it, problem-specific extensions can carry more than one instance of the same problem type β¨. For example:
POST /details HTTP/1.1
Host: account.example.com
Accept: application/json
{
"age": 42.3,
"profile": {
"color": "yellow"
}
}
HTTP/1.1 422 Unprocessable Content
Content-Type: application/problem+json
Content-Language: en
{
"type": "https://example.net/validation-error",
"title": "Your request is not valid.",
"errors": [
{
"detail": "must be a positive integer",
"pointer": "#/age"
},
{
"detail": "must be 'green', 'red' or 'blue'",
"pointer": "#/profile/color"
}
]
}
The fictional problem type in this example defines an "errors" extension π. It's an array that describes the details of each validation error. Each member is an object with "detail" to describe the issue, and "pointer" to locate the problem inside the request's content using a JSON Pointer [JSON-POINTER].
When an API runs into multiple problems that don't share the same type, it is RECOMMENDED that the most relevant or urgent problem be represented in the response. You could make generic "batch" problem types that bundle multiple, different types together, but they don't map well onto HTTP semantics π.
Also note that the API responded with the "application/problem+json" type even though the client didn't list it in Accept. HTTP allows that (see Section 12.5.1 of [HTTP]) π .
3.1. Members of a Problem Details Object π
Problem detail objects can have the following members. If a member's value type doesn't match the specified type, the member MUST be ignored -- processing carries on as if that member had never been there π§.
3.1.1. "type" π¦
The "type" member is a JSON string containing a URI reference [URI] that identifies the problem type. Consumers MUST use the "type" URI (after resolution, if necessary) as the problem type's primary identifier π.
When this member isn't present, its value is assumed to be "about:blank" π«§.
If the type URI is a locator (like one with an "http" or "https" scheme), dereferencing it SHOULD provide human-readable documentation for the problem type (for example, using HTML [HTML5]). However, consumers SHOULD NOT automatically dereference the type URI, unless they do so when providing info to developers (like when a debugging tool is in use) π οΈ.
When "type" contains a relative URI, it gets resolved against the document's base URI, as per [URI], Section 5. Real talk though, relative URIs can cause confusion, and not every implementation handles them correctly π¬.
Here's the spicy example πΆοΈ. If the two resources "https://api.example.org/foo/bar/123" and "https://api.example.org/widget/456" both respond with a "type" equal to the relative URI reference "example-problem", then once resolved they point at different resources: "https://api.example.org/foo/bar/example-problem" and "https://api.example.org/widget/example-problem", respectively. So it is RECOMMENDED that absolute URIs be used in "type" when possible, and that when relative URIs are used, they include the full path (for example, "/types/123") π.
The type URI is allowed to be non-resolvable. For example, the tag URI scheme [TAG] can be used to uniquely identify problem types:
tag:example@example.org,2021-09-17:OutOfLuck
That said, resolvable type URIs are encouraged by this spec, because it might become desirable to resolve the URI in the future π. Say an API designer used the URI above, and later adopted a tool that resolves type URIs to find out more about the error. Taking advantage of that would mean switching to a resolvable URI, which creates a new identity for the problem type and introduces a breaking change π.
3.1.2. "status" β¨
okay so the "status" member is a JSON number π’ holding the HTTP status code ([HTTP], Section 15) that the origin server generated for this particular occurrence of the problem π
The "status" member, if present, is only advisory π«Ά It's just there to tell the consumer which HTTP status code got used, for their convenience. Generators MUST use the same status code in the actual HTTP response, so that generic HTTP software which doesn't understand this format still behaves correctly π See Section 5 for further caveats about using it π
Consumers can look at the status member to figure out what the original status code was when it's been changed (e.g., by an intermediary or cache) π¦ It's also handy when a message's content gets persisted without any HTTP information attached π Generic HTTP software will still use the HTTP status code, no cap π
3.1.3. "title" πΈ
The "title" member is a JSON string with a short, human-readable summary of the problem type β¨
It SHOULD NOT change from occurrence to occurrence of the problem, except for localization π (for example, using proactive content negotiation; see [HTTP], Section 12.1) π
The "title" string is advisory π«Ά It's only included for users who are unaware of, and can't discover, the semantics of the type URI (e.g., during offline log analysis) π
3.1.4. "detail" π
The "detail" member is a JSON string with a human-readable explanation specific to this occurrence of the problem π
The "detail" string, if present, ought to focus on helping the client correct the problem, rather than giving debugging information π Main character energy is helping people fix things, not dumping logs π
Consumers SHOULD NOT parse the "detail" member for information; extensions are more suitable and less error-prone ways to obtain such information π§ Honestly, don't parse the detail string, bestie π
3.1.5. "instance" π¦
The "instance" member is a JSON string containing a URI reference that identifies this specific occurrence of the problem π
When the "instance" URI is dereferenceable, the problem details object can be fetched from it π It might also return information about the occurrence in other formats through proactive content negotiation (see [HTTP], Section 12.5.1) β¨
When the "instance" URI is not dereferenceable, it works as a unique identifier for the problem occurrence π It might matter to the server, but it's opaque to the client π
When "instance" contains a relative URI, it's resolved relative to the document's base URI, as per [URI], Section 5 π However, using relative URIs can cause confusion, and they might not be handled correctly by all implementations π
Here's an example π
For example, if the two resources "https://api.example.org/foo/
bar/123" and "https://api.example.org/widget/456" both respond with
an "instance" equal to the relative URI reference "example-instance",
when resolved they will identify different resources
("https://api.example.org/foo/bar/example-instance" and
"https://api.example.org/widget/example-instance", respectively).
See how the same relative value lands in two different places?? π€― That's why it is RECOMMENDED that absolute URIs be used in "instance" when possible, and that when relative URIs are used, they include the full path (e.g., "/instances/123") π
3.2. Extension Members π§
Problem type definitions MAY extend the problem details object with additional members that are specific to that problem type π
For example, our out-of-credit problem above defines two such extensions, "balance" and "accounts", to convey additional, problem-specific information π
Similarly, the "validation error" example defines an "errors" extension that contains a list of individual error occurrences found, with details and a pointer to the location of each π
Clients consuming problem details MUST ignore any such extensions that they don't recognize; this lets problem types evolve and include additional information in the future π¦
When creating extensions, problem type authors should choose their names carefully π To be used in the XML format (see Appendix B), they will need to conform to the Name rule in Section 2.3 of [XML] π
4. Defining New Problem Types β¨
When an HTTP API needs to define a response that indicates an error condition, it might be appropriate to do so by defining a new problem type πΈ
Before doing so, it's important to understand what they are good for and what is better left to other mechanisms π§
Problem details are not a debugging tool for the underlying implementation π ββοΈ Rather, they are a way to expose greater detail about the HTTP interface itself π Designers of new problem types need to carefully take into account the Security Considerations (Section 5), in particular the risk of exposing attack vectors by exposing implementation internals through error messages π
Likewise, truly generic problems (i.e., conditions that might apply to any resource on the Web) are usually better expressed as plain status codes π For example, a "write access disallowed" problem is probably unnecessary, since a 403 Forbidden status code in response to a PUT request is self-explanatory π
Finally, an application might have a more appropriate way to carry an error in a format it already defines π«Ά Problem details are meant to avoid the need for new "fault" or "error" document formats, not to replace existing domain-specific formats π
That said, it is possible to add support for problem details to existing HTTP APIs using HTTP content negotiation (e.g., using the Accept request header to indicate a preference for this format; see [HTTP], Section 12.5.1) β¨
New problem type definitions MUST document:
- a type URI (typically, with the "http" or "https" scheme)
- a title that appropriately describes it (think short)
- the HTTP status code for it to be used with
Problem type definitions MAY specify the use of the Retry-After response header ([HTTP], Section 10.2.3) in appropriate circumstances π°οΈ
A problem type URI SHOULD resolve to HTML [HTML5] documentation that explains how to resolve the problem π
A problem type definition MAY specify additional members on the problem details object π For example, an extension might use typed links [WEB-LINKING] to another resource that machines can use to resolve the problem π
If such additional members are defined, their names SHOULD start with a letter (ALPHA, as per [ABNF], Appendix B.1) π€ and SHOULD comprise characters from ALPHA, DIGIT ([ABNF], Appendix B.1), and "_" (so that it can be serialized in formats other than JSON) π They SHOULD be three characters or longer π
4.1. Example π
For example, if you're publishing an HTTP API for your online shopping cart, you might need to show that the user is out of credit (our example from above) and therefore can't make the purchase π
If you already have an application-specific format that can carry this information, it's probably best to use that π«Ά But if you don't, you might use one of the problem detail formats: JSON if your API is JSON-based, or XML if it uses that format π
To do so, you might look in the registry (Section 4.2) for an already-defined type URI that suits your purposes π If one is available, you can reuse that URI β¨
If one isn't available, you could mint and document a new type URI (which ought to be under your control and stable over time) π along with an appropriate title, the HTTP status code it will be used with, and what it means and how it should be handled π
4.2. Registered Problem Types π
This specification defines the "HTTP Problem Types" registry for common, widely used problem type URIs, to promote reuse πΈ
The policy for this registry is Specification Required, per [RFC8126], Section 4.6 π
When evaluating requests, the designated expert(s) should consider community feedback, how well-defined the problem type is, and this specification's requirements π§ Vendor-specific, application-specific, and deployment-specific values are unable to be registered π ββοΈ Specification documents should be published in a stable, freely available manner (ideally located with a URL), but they need not be standards π¦
Registrations MAY use the prefix "https://iana.org/assignments/http-problem-types#" for the type URI π Note that those URIs may not be able to be resolved π
The following template should be used for registration requests:
Type URI: [a URI for the problem type]
Title: [a short description of the problem type]
Recommended HTTP status code: [what status code is most appropriate
to use with the type]
Reference: [to a specification defining the type]
See the registry at <https://iana.org/assignments/http-problem-types> for details on where to send registration requests π¬
4.2.1. about:blank π«§
This specification registers one Problem Type, "about:blank", as follows π
Type URI: about:blank
Title: See HTTP Status Code
Recommended HTTP status code: N/A
Reference: RFC 9457
The "about:blank" URI [ABOUT], when used as a problem type, indicates that the problem has no additional semantics beyond that of the HTTP status code πΈ
When "about:blank" is used, the title SHOULD be the same as the recommended HTTP status phrase for that code (e.g., "Not Found" for 404, and so on) π although it MAY be localized to suit client preferences (expressed with the Accept-Language request header) π
Please note that according to how the "type" member is defined (Section 3.1), the "about:blank" URI is the default value for that member π§ Consequently, any problem details object not carrying an explicit "type" member implicitly uses this URI π
5. Security Considerations π
When defining a new problem type, the information included must be carefully vetted π Likewise, when actually generating a problem (however it is serialized), the details given must also be scrutinized π
Risks include leaking information that can be exploited to compromise the system, access to the system, or the privacy of users of the system π¨
Generators providing links to occurrence information are encouraged to avoid making implementation details such as a stack dump available through the HTTP interface π since this can expose sensitive details of the server implementation, its data, and so on π
The "status" member duplicates the information available in the HTTP status code itself, bringing the possibility of disagreement between the two π¬ Their relative precedence is not clear, since a disagreement might indicate that (for example) an intermediary has changed the HTTP status code in transit (e.g., by a proxy or cache) π¦ Generic HTTP software (such as proxies, load balancers, firewalls, and virus scanners) is unlikely to know of or respect the status code conveyed in this member π
6. IANA Considerations ποΈ
In the "application" registry under the "Media Types" registry, IANA has updated the "application/problem+json" and "application/problem+xml" registrations to refer to this document π
IANA has created the "HTTP Problem Types" registry as specified in Section 4.2 and populated it with "about:blank" as per Section 4.2.1 π
7. References π
7.1. Normative References π
- [ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, DOI
10.17487/RFC5234, January 2008,https://www.rfc-editor.org/info/rfc5234. - [HTTP] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., "HTTP Semantics", STD 97, RFC 9110, DOI
10.17487/RFC9110, June 2022,https://www.rfc-editor.org/info/rfc9110. - [JSON] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI
10.17487/RFC8259, December 2017,https://www.rfc-editor.org/info/rfc8259. - [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI
10.17487/RFC2119, March 1997,https://www.rfc-editor.org/info/rfc2119. - [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 8126, DOI
10.17487/RFC8126, June 2017,https://www.rfc-editor.org/info/rfc8126. - [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI
10.17487/RFC8174, May 2017,https://www.rfc-editor.org/info/rfc8174. - [URI] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, DOI
10.17487/RFC3986, January 2005,https://www.rfc-editor.org/info/rfc3986. - [XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., Maler, E., and F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth Edition)", W3C Recommendation REC-xml-20081126, November 2008,
https://www.w3.org/TR/2008/REC-xml-20081126/.
7.2. Informative References πΈ
- [ABOUT] Moonesamy, S., Ed., "The "about" URI Scheme", RFC 6694, DOI
10.17487/RFC6694, August 2012,https://www.rfc-editor.org/info/rfc6694. - [HTML5] WHATWG, "HTML: Living Standard",
https://html.spec.whatwg.org. - [ISO-19757-2] ISO, "Information technology -- Document Schema Definition Language (DSDL) -- Part 2: Regular-grammar-based validation -- RELAX NG", ISO/IEC 19757-2:2008, December 2008,
https://www.iso.org/standard/52348.html. - [JSON-POINTER] Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., "JavaScript Object Notation (JSON) Pointer", RFC 6901, DOI
10.17487/RFC6901, April 2013,https://www.rfc-editor.org/info/rfc6901. - [JSON-SCHEMA] Wright, A., Ed., Andrews, H., Ed., Hutton, B., Ed., and G. Dennis, "JSON Schema: A Media Type for Describing JSON Documents", Work in Progress, Internet-Draft, draft-bhutton-json-schema-01, 10 June 2022,
https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-01. - [RDFA] Adida, B., Birbeck, M., McCarron, S., and I. Herman, "RDFa Core 1.1 - Third Edition", W3C Recommendation, March 2015,
https://www.w3.org/TR/2015/REC-rdfa-core-20150317/. - [RFC7807] Nottingham, M. and E. Wilde, "Problem Details for HTTP APIs", RFC 7807, DOI
10.17487/RFC7807, March 2016,https://www.rfc-editor.org/info/rfc7807. - [TAG] Kindberg, T. and S. Hawke, "The 'tag' URI Scheme", RFC 4151, DOI
10.17487/RFC4151, October 2005,https://www.rfc-editor.org/info/rfc4151. - [WEB-LINKING] Nottingham, M., "Web Linking", RFC 8288, DOI
10.17487/RFC8288, October 2017,https://www.rfc-editor.org/info/rfc8288. - [XSLT] Clark, J., Pieters, S., and H. Thompson, "Associating Style Sheets with XML documents 1.0 (Second Edition)", W3C Recommendation, October 2010,
https://www.w3.org/TR/2010/REC-xml-stylesheet-20101028/.
Appendix A. JSON Schema for HTTP Problems π
This section presents a non-normative JSON Schema [JSON-SCHEMA] for HTTP problem details. If there is any disagreement between it and the text of the specification, the latter prevails.
# NOTE: '\' line wrapping per RFC 8792
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "An RFC 7807 problem object",
"type": "object",
"properties": {
"type": {
"type": "string",
"format": "uri-reference",
"description": "A URI reference that identifies the \
problem type."
},
"title": {
"type": "string",
"description": "A short, human-readable summary of the \
problem type."
},
"status": {
"type": "integer",
"description": "The HTTP status code \
generated by the origin server for this occurrence of the problem.",
"minimum": 100,
"maximum": 599
},
"detail": {
"type": "string",
"description": "A human-readable explanation specific to \
this occurrence of the problem."
},
"instance": {
"type": "string",
"format": "uri-reference",
"description": "A URI reference that identifies the \
specific occurrence of the problem. It may or may not yield \
further information if dereferenced."
}
}
}
Appendix B. HTTP Problems and XML π¦
HTTP-based APIs that use XML [XML] can express problem details using the format defined in this appendix.
The RELAX NG schema [ISO-19757-2] for the XML format is:
default namespace ns = "urn:ietf:rfc:7807"
start = problem
problem =
element problem {
( element type { xsd:anyURI }?
& element title { xsd:string }?
& element detail { xsd:string }?
& element status { xsd:positiveInteger }?
& element instance { xsd:anyURI }? ),
anyNsElement
}
anyNsElement =
( element ns:* { anyNsElement | text }
| attribute * { text })*
Note that this schema is only intended as documentation and not as a normative schema that captures all constraints of the XML format. It is possible to use other XML schema languages to define a similar set of constraints (depending on the features of the chosen schema language).
The media type for this format is application/problem+xml.
Extension arrays and objects are serialized into the XML format by considering an element containing a child or children to represent an object, except for elements containing only one or more child elements named i, which are considered arrays. For example, the example above appears in XML as follows:
HTTP/1.1 403 Forbidden
Content-Type: application/problem+xml
Content-Language: en
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="urn:ietf:rfc:7807">
<type>https://example.com/probs/out-of-credit</type>
<title>You do not have enough credit.</title>
<detail>Your current balance is 30, but that costs 50.</detail>
<instance>https://example.net/account/12345/msgs/abc</instance>
<balance>30</balance>
<accounts>
<i>https://example.net/account/12345</i>
<i>https://example.net/account/67890</i>
</accounts>
</problem>
This format uses an XML namespace, primarily to allow embedding it into other XML-based formats; it does not imply that it can or should be extended with elements or attributes in other namespaces. The RELAX NG schema explicitly only allows elements from the one namespace used in the XML format. Any extension arrays and objects MUST be serialized into XML markup using only that namespace.
When using the XML format, it is possible to embed an XML processing instruction in the XML that instructs clients to transform the XML, using the referenced XSL Transformations (XSLT) code [XSLT]. If this code is transforming the XML into (X)HTML, then it is possible to serve the XML format, and yet have clients capable of performing the transformation display human-friendly (X)HTML that is rendered and displayed at the client. Note that when using this method, it is advisable to use XSLT 1.0 in order to maximize the number of clients capable of executing the XSLT code.
Appendix C. Using Problem Details with Other Formats π§
In some situations, it can be advantageous to embed problem details in formats other than those described here. For example, an API that uses HTML [HTML5] might want to also use HTML for expressing its problem details.
Problem details can be embedded in other formats either by encapsulating one of the existing serializations (JSON or XML) into that format or by translating the model of a problem detail (as specified in Section 3) into the format's conventions.
For example, in HTML, a problem could be embedded by encapsulating JSON in a script tag:
<script type="application/problem+json">
{
"type": "https://example.com/probs/out-of-credit",
"title": "You do not have enough credit.",
"detail": "Your current balance is 30, but that costs 50.",
"instance": "/account/12345/msgs/abc",
"balance": 30,
"accounts": ["/account/12345",
"/account/67890"]
}
</script>
or by defining a mapping into a Resource Description Framework in Attributes (RDFa) [RDFA].
This specification does not make specific recommendations regarding embedding problem details in other formats; the appropriate way to embed them depends both upon the format in use and application of that format.
Appendix D. Changes from RFC 7807 β¨
This revision has made the following changes:
- Section 4.2 introduces a registry of common problem type URIs
- Section 3 clarifies how multiple problems should be treated
- Section 3.1.1 provides guidance for using type URIs that cannot be dereferenced
Acknowledgements π«Ά
The authors would like to thank Jan Algermissen, Subbu Allamaraju, Mike Amundsen, Roy Fielding, Eran Hammer, Sam Johnston, Mike McCall, Julian Reschke, and James Snell for their comments and suggestions.
Authors' Addresses π
Mark Nottingham Prahran Australia Email: mnot@mnot.net URI: https://www.mnot.net/
Erik Wilde Email: erik.wilde@dret.net URI: http://dret.net/netdret/
Sanjay Dalal United States of America Email: sanjay.dalal@cal.berkeley.edu URI: https://github.com/sdatspun2
π¦ where this page comes from
- ietf: rfc9457 2023-07
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms