3 ms·
To be fair, the verbs can feel a little weird. GET is easy. HEAD is easy. DELETE is easy. PATCH is easy, especially when you use one of the two more useful
by abraae 10y ago
To be fair, the verbs can feel a little weird.
GET is easy.
HEAD is easy.
DELETE is easy.
PATCH is easy, especially when you use one of the two more useful standards (RFC 7386: JSON Merge Patch, or RFC 6902: JSON Patch).
PUT is not much use for large resources (like those typically found in business systems) since it requires you to provide every field, but usually you would want the back end to assign at the last the primary identifier, date created, etc. I seem to remember reading that even Roy felt PUT was not well designed.
POST is a catch all for any other update/insert type activity.
To paraphrase Winston Churchill, "http verbs are a poor system, but better than all the other systems that have been tried from time to time."
- martin-adams 10y agoWhen you say you want the server to assign the identifier and additional fields, then I guess this would be considered read-only metadata against the resource. I don't recall seeing anything stating that in my RESTful travels.
- abraae 10y agoRead-only or not, its still part of the resource, and so PUT must supply it. Here's a nice writeup: https://stormpath.com/blog/put-or-post https://stormpath.com/blog/put-or-post