Media Types: Difference between revisions
(Created page with "A Media Type is a description of a file format plus a description of the interactions a client can make when viewing the file. Media Types are referenced using their identifie...") |
No edit summary |
||
Line 5: | Line 5: | ||
== Identifiers == | == Identifiers == | ||
Media Type identifiers are constructed using a ''tree'' part, a ''subtype'' and optionally a ''suffix''. A full example is: ''application/vnd.delftsolutions.contact_us.v1+json''. Here the tree is ''application'', the subtype is ''vnd.delftsolutions.contact_us.v1'' and the suffix is ''json''. | Media Type identifiers are constructed using a ''tree'' part, a ''subtype'' and optionally a ''suffix''. A full example is: ''application/vnd.delftsolutions.contact_us.v1+json''. Here the tree is ''application'', the subtype is ''vnd.delftsolutions.contact_us.v1'' and the suffix is ''json''. | ||
The available tree parts are limited to: | |||
* application (everything not covered under the other categories) | |||
* audio (rendered as audio) | |||
* font (can be used to render text) | |||
* example (for use in documentation) | |||
* image (rendered as a static image) | |||
* message | |||
* model | |||
* multipart | |||
* text (for human consumption as text) | |||
* video (contains video) | |||
Commonly used suffixes are: | |||
* html | |||
* json | |||
* xml | |||
If you create your own mediatypes you usually want to put them in the ''application'' tree and use a ''vnd.<companyname>'' prefix on the ''subtype''. |
Revision as of 08:21, 30 November 2020
A Media Type is a description of a file format plus a description of the interactions a client can make when viewing the file. Media Types are referenced using their identifier. In online documentation the term Media Type is often used to mean either the Media Type description or the Media Type identifier.
A simple example of a media type is the GIF format, identified using image/gif. It has no interactions (it doesn't link to anything) and has a specification that tells clients how they should display it.
Identifiers
Media Type identifiers are constructed using a tree part, a subtype and optionally a suffix. A full example is: application/vnd.delftsolutions.contact_us.v1+json. Here the tree is application, the subtype is vnd.delftsolutions.contact_us.v1 and the suffix is json.
The available tree parts are limited to:
- application (everything not covered under the other categories)
- audio (rendered as audio)
- font (can be used to render text)
- example (for use in documentation)
- image (rendered as a static image)
- message
- model
- multipart
- text (for human consumption as text)
- video (contains video)
Commonly used suffixes are:
- html
- json
- xml
If you create your own mediatypes you usually want to put them in the application tree and use a vnd.<companyname> prefix on the subtype.