[Hawkular-dev] REST ideas

Michael Burman miburman at redhat.com
Wed Feb 11 15:22:20 EST 2015


Hi,

No, I disagree. PUT can create just as well as POST. Idempotency is the 
only difference. With PUT, you give the full resource path (thus, you 
will always modify the same instance).

Thus, with inventory the usage of:

PUT /resource/id
vs.
POST /resources

Would be correct. Just like GET /resources vs. GET /resource/id. 
However, with POST /resources, one could create an element without the 
resource id element, as the full path would be returned in the HTTP 
response (Location).

I'm not however advocating for pure HATEOAS, as that's often painful to 
follow, but if we can - we should. It forces to think about the interface.

   - Micke

On 11.02.2015 21:08, Jiri Kremser wrote:
> | I am no REST expert but an "empty POST" seems weird to me as does specifying
> | the ID as an parameter in POST request. It is just my personal taste, but I
> | find the PUT for creation here the most natural.
>
> -1. PUT is for modifying and POST for creating new resources, that's the convention. That's what client writers would expect. The POST request doesn't have to be completely empty, there can be the id as Viliam had mentioned or in the future there can be additional fields. Let's listen to the wisdom of RESTafarians here :)
>
> http://www.restapitutorial.com/lessons/httpmethods.html
>
> jk
> _______________________________________________
> hawkular-dev mailing list
> hawkular-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hawkular-dev



More information about the hawkular-dev mailing list