title: Django webservice for POST data
body: <p>I'm trying to create a web service in Django. For some reason it is working in a GET request but not as a POST (which is my requirement). I have the below url:</p>
  
  <pre><code>url(r'^rest/user/(.*)/(.*)/$', 'rest.views.user.user')
  </code></pre>
  
  <p>So if the user was to send a message to <code>/rest/user/ANY_CHARACTER/ANY_CHARACTER/</code>, it will go to the below function:</p>
  
  <pre><code>def user(request, string1, string2):
      if request.method == "POST":
          return HttpResponse(string1 +  ' ' + string2)
      else:
          return HttpResponse('error')
  </code></pre>
  
  <p>Everytime I send a GET request, i'm getting <code>error</code> (which is correct), but everytime I send the same URL as POST, i'm getting HTTP 500 error. Is there something i'm missing here?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The error log in the terminal has the following:
  <code>[02/Jul/2012 19:13:57] "POST /rest/user/hi/hi HTTP/1.1" 500 61994</code></p>
  
  <p>However, when I send the same command as GET, I'm not getting any errors...which is very strange.</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>I'm noticing the below error when I send a POST request, it works on all other types:</p>
  
  <pre><code>&lt;p&gt;Reason given for failure:&lt;/p&gt;
  &lt;pre&gt;
  CSRF token missing or incorrect.
  &lt;/pre&gt;
  
  
  &lt;p&gt;In general, this can occur when there is a genuine Cross Site Request Forgery, or when
  &lt;a href='http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ref-contrib-csrf'&gt;Django's
  CSRF mechanism&lt;/a&gt; has not been used correctly.  For POST forms, you need to
  ensure:&lt;/p&gt;
  </code></pre>
  
  <p>My question is...how do I handle this for webservice requests? Sorry, tried searching for this, but is there a way to get around CSRF for RESTful webservice requests?</p>