Forum: Ruby on Rails RoR REST HTTP PUT: XML payload option?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D78fa6fe182d69d87357dd759ec7c5c4?d=identicon&s=25 Mark Murphy (Guest)
on 2007-02-08 20:36
(Received via mailing list)
I'm attempting to create a RESTful Web service using 1.2.2. I would
like to be able to update a model via an XML payload PUT to the
controller, but the scaffold_resource PUT handler
(MyController#update) seems to only work with values of the form
"modelname[columname]=value". If I supply anything else -- such as the
same XML that the scaffolded GET returns -- it gets ignored by the

I'm guessing that I need to roll my own #update, which is fine. How
can I get my hands on the raw data sent over by the PUT invocation? Or
is there a better way of accomplishing this?


Mark Murphy
D78fa6fe182d69d87357dd759ec7c5c4?d=identicon&s=25 Mark Murphy (Guest)
on 2007-02-08 21:03
(Received via mailing list)
I figured it out by poking through the ActiveController::Base source.

To make this work, you have to specify "Content-type: application/xml"
in the HTTP PUT request. This triggers logic set up by default in the
ActionController::Base.param_parsers hash to parse the XML and put it
in the params hash for the REST controller to use.

This topic is locked and can not be replied to.