I got asked to do a code review of a very simple one-route web service that when hit would simply restart an application on the system. The developer had coded this up as a POST which strikes me as odd.
Now I realize that this is not really the type of thing that HTTP is all about – you can’t even query state – but is there a more appropriate HTTP verb? My intuition is that since this is mostly idempotent and creates no new resources it should be a PUT.
1
I would also use POST for this, though I can see an argument for PUT. Based on RFC 2616 and my own experience, PUT is usually reserved for updating or replacing a resource. While restarting an application could conceptually fall into that category, to me this seems more like a server-side action, which is typically the purview of a POST request.
2