I know there's a whole RFC for HTTP methods but I was wondering what would be the expected behaviour from a PUT to a REST API that responds with Content-type: application/json
and accepts JSON encoded bodies.
PATCH
method RFC 5789).Any comment or resource for me to read will be welcome.
In practice, either of those approaches is all right as long you stick to it throughout the whole application so you keep consistency. I personally like to use PUT if I want to update all the attributes of a record according to the ID. This way I can save the PATCH method for endpoints where I need to specify and update only some attributes like the a typical change password request where I only need to update a specific attribute.
I really recommend this book: http://www.amazon.com/REST-API-Design-Handbook-ebook/dp/B00890OBFI/ref=sr_1_2?s=books&ie=UTF8&qid=1425669926&sr=1-2&keywords=rest+api