On 2011-06-13, at 18:45 , Shawn Milochik wrote: > Is there a consensus in the community that GET should be used for > requests that don't write to the database? As a specific example, let's > say there's a report form that allows a user to select a start and end > date, and maybe some other search fields. What would you use for this, > and why? GET.
The contract of GET is that it's safe (it perform no operation other than data retrieval and pure computations), GET is idempotent (performing N GET has the same effect on the system's visible state than performing one, or zero), GET can be cached and prefetched. That's the whole point of GET. GET also maps the application state to the URL directly, allowing for saving and sharing state (and virtual location) between machines and people. If I query the report system and get an interesting report, if the system correctly uses GET I can send the URL to Instapaper, to my desktop (if I'm on a mobile phone) or to a colleague, and these three systems will see what I had in hand. I can also get the report back from my history if I want to check something again in half an hour, I don't need to remember the parameters (which I'm not even sure I could do) let alone go through a potentially lengthy and multi-step wizard I have no need for. And there's more: depending on the architectural elements between my machine and your server, it's possible that none of the subsequent requests even had to hit your machines, resulting in a resource draw of 0. The over-reliance on POST is a pox, a bane on the modern web, not helped by browsers still refusing to implement further standard HTTP/1.1 methods (such as PUT and DELETE). And I'm not even mentioning extension methods (PATCH for instance). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.