Rules of Thumb for HTTP Verbs

Web services are woderful things. But, have you ever found yourself designing a RESTful API and wondering which verb to use? Here are some general rules of thumb...

  • Are you providing the data and the logic? Use GET.
  • Are they providing the data and you're providing the logic? Use POST.
  • Are they just adding data to your collection? Use PUT.
  • Are they trying to delete data from your collection? You should check their damn permissions, if they're cool use DELETE.

You can even mix and match these verbs on the same endpoint. I use a lot of Node.js at work, and I prefer to use Express to map different logic to different verbs on an endpoint. Your preferences may change base don your platform, but those guidelines will stay the same.