A Web Resource and Its Representations

A resource can be identified by an endpoint while several representations convey some of its state.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a catalogue entry
  2. Name differences deliberately
  3. Preserve one resource identity across display formats
  4. Verify cache and variant behavior

Trace a catalogue entry

One book can appear as an HTML page for readers and as structured fields for a program. Both may store the same record ID. The representation metadata tells a receiver how to interpret each result.

Name differences deliberately

A display might use a formatted date while a data export supplies a structured timestamp. Parsing and formatting explains why these outputs need separate contracts even when they represent the same source.[1][2]

Preserve one resource identity across display formats

A catalogue item can appear as a human-readable HTML page or as a JSON representation. Both contain ID seven and describe the same item under a documented format selection rule. Rendering bytes and resource identity answer different questions. See HTTP content type.

Resource: item 7
HTML: title and details for people
JSON: structured fields for a consumer
Each representation declares the appropriate media type

Verify cache and variant behavior

If the server selects representation based on Accept, caches may need the matching variant rules. Test a request for each advertised format and confirm both identify the same current item without mixing fields.

References

  1. IETF, RFC 9110: HTTP Semantics ↩
  2. WHATWG, HTML Living Standard: Forms ↩