Once I see this:
POST => create a brand new object
DELETE => delete an object
PUT => modify an object
Some say issues like this technique is Idempotent and this one is just not.
However I see that I can do all of that with POST
, the massive distinction I discover is that utilizing totally different strategies permits documenting an API, organizing the code, simple communication with different APIs that comply with the identical commonplace, and so on.
Is that appropriate? or is there one thing else? comparable to Go internally treats every technique otherwise, thus far I haven’t seen Go do this, however what do I do know.
Anyway, are these verbs simply strings and the implementation is left to me? or does Go do some mischief to comply with that commonplace?
It’s no a solely Go idea however mathematical. In a basic method, it signifies that calling many occasions a perform with the identical enter, you’ll get the identical outcomes. To have a greater clarification, examine What’s Idempotency?
that definition could also be appropriate however provides nothing to what the OP most likely has already learn.
in observe it actually means
“regardless of what number of occasions a perform is named its habits, particularly unintended effects, ought to be the identical as solely calling it as soon as”.
additionally you could have POST and PUT reversed.
POST is for RPC like duties, PUT is for simply that PUTing new sources or updating present sources in place.
idempotent PUT means regardless of what number of occasions you name PUT with the identical enter information it solely creates the useful resource as soon as, updates wouldn’t change the useful resource state both.
It’s good that every part is clarified