I’m trying to figure out how to implement my first RESTful interface using Django and django-rest-interface. I’m having problems with the HTTP PUT requests.
How do I access the parameters of the PUT request? I thought they would be in the request.POST array, as PUT is somewhat similar to POST in my understanding, but that array is always empty.
What am I doing wrong?
Thanks for the help
request.POST processes form-encoded data into a dictionary, which only makes sense for web browser form submissions. There is no equivalent for PUT, as web browsers don’t PUT forms; the data submitted could have any content type. You’ll need to get the raw data out of request.raw_post_data, possibly check the content type, and process it however makes sense for your application.
More information in this thread.