by Dunedan · 9y ago · 0 comments
I get that part about the DELETE, but no response for GET sounds odd. As I couldn't find anything in the spec RC: Is there further information available regarding that?
However, I'm not sure there is a definitive answer on if that's true from an HTTP perspective. I also couldn't find it in a skimming of the OpenAPI 3.0 spec.
In the end, REST [1] itself does not prescribe either condition and the HTTP 1.1 [2] spec doesn't either.
> A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.
[1] https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arc... [2] https://tools.ietf.org/html/rfc7231#section-4.3.1
Imo, a flaw in the earlier spec. It's clearly the case that people have uses for requesting data via JSON, and GET is the only thing that fits expected semantics ATM. Elasticsearch takes json over GET bodies because it just makes sense.
A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.
But how would you, say, bulk delete 5 different resources? I typically send those payloads in the request body of a DELETE request.
From the RFC: The DELETE method requests that the origin server delete the resource identified by the Request-URI.
https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
If the ids are in the body, you are not deleting the resource at the URI. I think that for this kind of operation you are better off with a POST.