OK, I already know all the reasons on paper why I should not use HTTP GET when calling RESTful to update the status of something on the server. Thus, each time, possibly returning different data. And I know that this is wrong for the following “on paper” reasons:
- HTTP GET calls must be idempotent
- N> 0 calls should always get the same data back
- Violates the HTTP specification
- HTTP GET call is usually read-only
And I'm sure there are more reasons. But I need a concrete simple example to justify, except “Well, this violates the HTTP Spec!” .... or at least I hope so. I have also read the following, which are more consistent with the above list: Does RESTful break when I write stuff on the server when GET is called? and HTTP POST with URL request parameters - is it a good idea or not?
For example, can someone justify the above and why it is wrong / incorrect to use / incorrectly use HTTP GET with the following RESTful call
"MyRESTService/GetCurrentRecords?UpdateRecordID=5&AddToTotalAmount=10"
I know this is wrong, but hopefully this will help give an example to answer my original question. So the above will update recordID = 5 with AddToTotalAmount = 10 and then return the updated records. I know that POST should be used, but let me say that I used GET.
How exactly and answer my question, can this really cause a real problem? Like all violations from the above list of tokens, how to use HTTP GET to perform the above actions, there is some real problem? Too many times I enter a scenario where I can justify things with the words “Because the dock said so,” but I need a rationale and a better understanding of this.
Thanks!
atconway
source share