Welcome Guest, Not a member yet? Register   Sign In
Resource Routes - PUT vs PATCH
#10

Explaning more...

If you have a "product" entity with the following attributes:

- id
- title
- short_description
- description
- price
- stock
- uri
- rate
- bla

Every time that you need to update it. The PUT "forces" you to send all the attributes because have the function of REPLACE the entire entity. Then, if you need update ONLY the price attribute, you need to send ALL the other attributes.

The PATCH method enables you to send ONLY the price attribute. It is more flexible, save bandwidth traffic data and processing.

I read the GitHub REST API docs and see that it uses PATCH. I did some research and thought, "Why is PUT the default update verb in CI?"... And here is the question...

This change is only in the HTTP verb of Update. With a HTML form request nothing changes, continues to be with POST.

* I thought, originally, in Portuguese, Hahah.
Reply


Messages In This Thread
Resource Routes - PUT vs PATCH - by natanfelles - 07-20-2017, 06:15 PM
RE: Resource Routes - PUT vs PATCH - by Narf - 07-21-2017, 01:46 AM
RE: Resource Routes - PUT vs PATCH - by skunkbad - 07-21-2017, 04:37 PM
RE: Resource Routes - PUT vs PATCH - by kilishan - 07-22-2017, 08:02 PM
RE: Resource Routes - PUT vs PATCH - by ciadmin - 07-22-2017, 09:11 PM
RE: Resource Routes - PUT vs PATCH - by ciadmin - 07-22-2017, 10:04 PM
RE: Resource Routes - PUT vs PATCH - by natanfelles - 07-23-2017, 05:46 AM
RE: Resource Routes - PUT vs PATCH - by Narf - 07-24-2017, 12:17 AM
RE: Resource Routes - PUT vs PATCH - by skunkbad - 07-24-2017, 01:50 PM
RE: Resource Routes - PUT vs PATCH - by Narf - 07-25-2017, 12:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB