API supports 5 HTTP methods for interacting with resources:
GET
– request used to retrieve data. Never used to delete, update or insert data.POST
– request used to insert data. Posted data type – JSON.PATCH
– request used to update data. Only passed data will be updated. You don’t need to provide all data set.PUT
– create or update (replace) a resource. Useful for syncing data.DELETE
– remove data.
PATCH and PUT difference
HTTP PATCH
requests used to make partial update on a resource.
PUT
requests are used to modify/replace all resource entity.
PATCH
method is the correct choice for partially updating an existing resource and PUT
should only be used if you’re replacing a resource entirely.
HTTP Method tunneling
Note: HTTP Method tunneling can be used by making POST
operation and providing needed method in an X-HTTP-Method-Override
header.
So if you can't use PATCH
, PUT
or DELETE
methods - you can use POST
and X-HTTP-Method-Override
header to set PUT
, PATH
or DELETE
operation.