If I'm making a web application which integrates with a server-side backend, would it be considered best practice to use HTTP methods semantically? That is, for example, if I'm fetching data (e.g., to populate a menu, etc.), I would use GET, but to update data (e.g., save a record), I would use POST. (I realise there are other methods that may be even more appropriate, but we need to consider browser support.)

I can see the benefits of this in the sense that it's effectively a RESTful API, but at a slightly increased development cost. In my previous projects, I've POST'd everything: Is it worth switching to a RESTful mindset simply for the sake of best practice?

2 Answers
2

There are cool advantages also, like you can get stuff directly by accessing URLs from different parts of you application. Than when you post things you are covered and you don't expose stuff.

If you respect the verbs in you classes in whatever programming language you use, it will also help to better structure your code. Classes that are sending data will more naturally separate from those which are receiving or searching for information.

Yep. Using GETs for data retrieval means you can bookmark pages or send others links via email/chat/etc. And clicking 'reload' doesnt trigger the annoying 'post again?' message. Honestly, its little things like this that seem trivial that just start feeling "right" when you do them.
–
GrahamOct 25 '12 at 15:19