Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using django-rest-interface with http put

Tags:

python

django

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

like image 678
DanJ Avatar asked Feb 01 '09 08:02

DanJ


1 Answers

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.

like image 190
Carl Meyer Avatar answered Sep 23 '22 01:09

Carl Meyer