4
dan-pud
8y

PUT vs POST vs PATCH
And none of them fit!

Comments
  • 3
    do you want to:
    -- create a resource (post)
    -- replace a resource (put)
    -- change a resource (patch)

    thats how i learned when to use one or the other.
  • 0
    I feel you. The struggle is real
  • 0
    @mattwebdev
    none of the above :)
    just want to say for this resource go and do something, so it's kind of like an update but not really, more of a trigger
  • 0
    @dan-pud id say your trying to do too much with the API - an API should only get and set. the moment you ask it to do anything else... you are doing it wrong.
  • 0
    @mattwebdev, I like your explanation of what post, put, and patch are as it simplifies things from the docs. But I disagree that an api should only be get and set. There are many things you can do with an api that aren't get or set. Delete is a good example. Also, in our case where we have third party requests we need to make on the back of our request I think the normal rest verbs don't quite fit, and changing the api to make it fit I think goes against good design.
Add Comment