media type
A standard label for a data format, written type/subtype, such as application/json or text/event-stream.
In more detail
Media types appear in Content-Type and Accept. They are registered centrally so every client and server means the same thing by them. Versioning by media type puts the version inside such a label so the address can stay the same.
Example
application/json, application/problem+json and text/event-streamRelated terms
- Content-Type — The header that states what format a message body is in, such as application/json.
- Accept header — The request header in which a client lists the formats it can read, such as Accept: application/json.
- Problem Details — A standard JSON shape for HTTP error responses, defined in RFC 9457, with members such as type, title, status, detail and instance.
- API versioning — Giving an API contract a version so that incompatible changes can be released without breaking clients that use the old one.
Taught in
- Headers And Content Negotiation — Modern API Architecture: REST, GraphQL & gRPC
- Problem Details: RFC 9457 — Modern API Architecture: REST, GraphQL & gRPC
- Versioning APIs — Modern API Architecture: REST, GraphQL & gRPC
- Resilient Error Handling: Problem Details & Envelopes — Production Full-Stack Engineering
- Server-Sent Events: Streaming Updates & Recovery — Production Full-Stack Engineering