Can I use HTTP PUT method?

189 views
Skip to first unread message

诚子

unread,
Jul 31, 2009, 3:28:53 AM7/31/09
to web2py-users
Hi, I wan't use PUT method and DELETE method,to build a RESTful
service,how to get an PUT method and DELETE data?

mdipierro

unread,
Jul 31, 2009, 7:00:44 PM7/31/09
to web2py-users
I do not know for sure because PUT and DELETE are not standard http
methods. Try

request.vars
and
request.body.read()

Let us know.

Jonathan Lundell

unread,
Jul 31, 2009, 7:07:55 PM7/31/09
to web...@googlegroups.com
On Jul 31, 2009, at 4:00 PM, mdipierro wrote:

> I do not know for sure because PUT and DELETE are not standard http
> methods.

They are, actually; they're just not used by interactive web browsers.

http://en.wikipedia.org/wiki/Http#Request_methods

Yarko Tymciurak

unread,
Jul 31, 2009, 7:14:01 PM7/31/09
to web...@googlegroups.com
Hmmm....  check this page out:

http://www.w3.org/Amaya/User/Put.html

suiato

unread,
Jul 31, 2009, 10:03:48 PM7/31/09
to web2py-users
CouchDB seems to support PUT.

--
Teru

Bottiger

unread,
Jul 31, 2009, 10:04:11 PM7/31/09
to web2py-users
You will need to do request.body.read() for PUT. Web2Py does not parse
the body of PUT requests.

Example:

Request:

PUT /test/default/ HTTP/1.1
Content-Length: 21

blah blah hello hello


Output:

Body
"blah blah hello hello"

mdipierro

unread,
Aug 1, 2009, 6:49:36 AM8/1/09
to web2py-users
This could be changed but I do not know if put requests contain data
in body (as post) or url (as get). Can somebody point me to a relevant
rfc?

Alexey Nezhdanov

unread,
Aug 1, 2009, 8:12:44 AM8/1/09
to web...@googlegroups.com
Probably this:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6

I quickly skimmed through it and it seems that syntax is the same as with POST
with the difference that transferred contents must be saved under specified
path instead of being processed by some back-end.
--
Sincerely yours
Alexey Nezhdanov

Fran

unread,
Aug 1, 2009, 8:14:02 AM8/1/09
to web2py-users
On Aug 1, 11:49 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> This could be changed but I do not know if put requests contain data
> in body (as post) or url (as get). Can somebody point me to a relevant
> rfc?

http://www.ietf.org/rfc/rfc2616.txt

F

mdipierro

unread,
Aug 1, 2009, 3:41:14 PM8/1/09
to web2py-users
Check if argument parsing with PUT now work in trunk. I think it does.

Fran

unread,
Aug 1, 2009, 7:44:06 PM8/1/09
to web2py-users
On Jul 31, 8:28 am, 诚子 <zhicheng1...@gmail.com> wrote:
> Hi, I wan't use PUT method and DELETE method,to build a RESTful
> service,how to get an PUT method and DELETE data?

HTTP DELETE works fine :)

Check for it within your controller using:
if request.env.request_method == 'DELETE':

You can use this to test it:
http://code.google.com/p/rest-client/

I can't get the RESTclient to work with Auth though.
I see it send in the HTTP Header a line:
Authorization: Basic Zmxhdmetcetcetc===

I have set:
auth.settings.allow_basic_login = True

F
Reply all
Reply to author
Forward
0 new messages