0

RESTful GET requests to a given resource should be idempotent: identical requests should always return an identical result.

How is "identical" defined here--are documents with the same properties identical, regardless of the order? Or do I need to canonicalize my response body before returning it?

Stew
  • 4,495
  • 6
  • 31
  • 41
  • I'm not sure if implementation is relevant, but I am working with JSON in the response body. – Stew Aug 26 '16 at 19:53

1 Answers1

2

RESTful GET requests to a given resource should be idempotent: identical requests should always return an identical result.

In HTTP, GET requests to a given resource should be safe, which is to say that it is read-only, which is trivially idempotent.

no-op(X) === X

therefore

no-op(no-op(X)) === no-op(X)
QED.

Safe and idempotent are describing the side effects of the request on the server; they don't constrain the representation returned by the resource in any way.

For instance, the Online UUID Generator Tool resource returns an html page with different content each time send it a GET request. The request is safe (it doesn't modify the resource), and therefore idempotent, even though the representation returned isn't stable.

Community
  • 1
  • 1
VoiceOfUnreason
  • 52,766
  • 5
  • 49
  • 91