Metadata Pattern
Content profile resources are difficult to inspect because they contain metadata that is only discoverable after the client downloads the content. The Metadata pattern solves this by linking a Content resource to a Metadata resource describing the content. A client can examine the metadata and then decide to download all the content.
If the Content resource changes, the metadata may change as well to reflect new metadata values. If the client deletes a Content resource, it also deletes the related Metadata resource.
Metadata’s Info profile means the client cannot edit or delete the metadata directly. An API may wish to add user-editable resources like descriptions, tags or other information and link it to the Content resource. These additional resource relationships are outside the scope of this pattern.
Content Resource
profile: <https://level3.rest/patterns/metadata#content-resource>
The Content resource presents the Content profile. It is the image, document or other content data described by the Metadata resource.
metadata
rel="https://level3.rest/patterns/metadata#metadata"
The metadata
link relation is similar to IANA’s “describedby” link relation. It points to the Metadata resource that describes the Content resource.
Metadata Resource
profile: <https://level3.rest/patterns/metadata#metadata-resource>
The Metadata resource presents the Info profile and contains relevant details about the Content resource, depending on the type of content. Images can have metadata about the dimensions, resolution and colour model. Documents may contain metadata about the page count and author.
Metadata should be used in other API contexts like search results or directory listings as they provide useful information for the client to select a Content resource. The content
link gives the client navigability to the actual Content data should they choose to consume it.
content
rel="https://level3.rest/patterns/metadata#content"
The content
link relation is similar to IANA’s “describes” link relation. It points to the Content resource that Metadata describes.
Specifications
Protocol for Web Description Resources: POWDER
- “describedby”: Appendix D
The “describes” Link Relation Type: RFC 6892
© 2019-2023 Matt Bishop
This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.