Intent and Effects of HTTP Methods

HTTP method semantics describe a request's intended effect, including properties that help clients decide how requests may be repeated.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Compare reading and setting
  2. Account for different response observations
  3. Separate method intent from the resource's response format
  4. Verify effects by looking at application state

Compare reading and setting

GET requests a representation. PUT asks to create or replace the state of a resource with the supplied representation, subject to the server's rules. Setting one value twice can preserve the intended state. See idempotent transitions.

Account for different response observations

A repeated request can return different status or timing while having the same intended effect on the server. Retried operations explain why observable ancillary effects form an additional concern.[1]

Separate method intent from the resource's response format

A catalogue read can use GET, while submitting a request to create an export can use POST. Both can return JSON. A method's safety and idempotence refer to its defined semantics and intended effects, not the response's syntax. See repeatable state transitions.

GET catalogue item → observation
POST export request → may create a job
Both can respond with structured data
Repeating an operation needs its own declared behavior

Verify effects by looking at application state

A repeated retrieval can record access logs while still being a safe method under HTTP semantics. A creation endpoint can design request deduplication. Test the documented method and verify resulting state separately.

References

  1. IETF, RFC 9110: HTTP Semantics ↩