omg, when did PATCH become a thing?!

Options
Does it work?!? I'm not going to undo the update posts I've already got in place, but I'm excited to have this moving forward.

Comments

  • Sean Montgomery
    Sean Montgomery Administrator

    ADMIN

    Options
    PATCH is just an HTTP verb. There is no difference except for the verb. I personally would keep everything using POST just like Stripe does.
  • Erin Wagner
    Erin Wagner Member
    Options
     My understanding of PATCH vs. POST was that with PATCH, I could specify any property of a record and it would update just that property without having to even think about the other properties. Is that right? 'Cause if so, that's waaaay easier when a user updates a single item from their profile. What would be the benefit of (a) having to create a webhook with aaaaallllllllllll their user data, or (b) having to create a new endpoint for updating just that one property?
  • Sean Montgomery
    Sean Montgomery Administrator

    ADMIN

    Options
    That definitely sounds nice but the PATCH spec is just saying ideally you only send the data you need. That's the easy part - controlling what data should be allowed to send requires business logic. You don't want someone updating a field they don't have access to... how do you enforce that?

    What happens if you start triggering other actions in a PATCH call? Technically its only supposed to do the field update and thats it. It is very primitive. That is why companies like Stripe just default to POST.

    PATCH is there for the verb purists, but you still need to do the work.

    Btw - in tomorrows update we will have some new filters like set_ifnotempty which will make reduce the need for conditionals when wanting to update multiple fields - Michael will be making an update about that soon.