Hacker News new | ask | show | jobs
by xg15 466 days ago
Ah, sorry. No, I just left out sorting for brevity. Sorting the result of a query is a pure function of its parameters and the existing server state, so it would be perfectly valid to do server-side in a GET request.

But changing the "default" sort order of a resource (either by physically shuffling the rows on disk or by setting some server-side global variable) would not.

I think it's the difference between making a sorted copy of a list (while leaving the original list untouched) and inline-sorting the list.

Same applies to filtering.

Even storing the processed results in a cache does not validate idempotency, because from a client's POV, the behavior of the next request would be the same, whether the server calculates the result fresh or pulls it from the cache.

(Edit: Realized, I mixed up "idempotent" and "safe" methods there. I was talking about "safe" methods - but those are what applies to GET requests and what can be represented by a hyperlink)