We are planning to use GET
for all retrievals and DELETE
for all delete operations.
HTTP PUT
, POST
and PATCH
is confusing. After a lot of reading, this is my understanding. Please correct if I am wrong.
POST
- Not Idempotent ; so can be used for creating new resources/subordinate resource. Each time it creates a new one the ID gets changed and so it is best suited.
PUT
- Idempotent; cannot be used for create since the second time the same request comes, it creates a new resource again with different ID.
Can be used for update but all attributes should be passed each time it is updated. To achieve this, a GET
should be done prior to update operation. Overhead.
Why not use POST
for updates too?
PATCH
-Not sure if it is suitable for JAX-RS 1.1.
Thanks in advance.