# RoR REST HTTP PUT: XML payload option?

**URL:** <https://www.ruby-forum.com/t/ror-rest-http-put-xml-payload-option/84950>\
**Category:** Rails\
**Created:** [February 8, 2007, 8:36pm UTC](https://www.ruby-forum.com/t/ror-rest-http-put-xml-payload-option/84950 "2007-02-08T20:36:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Murphy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b9bd4f/32.png) [@Mark\_Murphy](https://www.ruby-forum.com/u/Mark_Murphy)\
**Post date:** [February 8, 2007, 8:36pm UTC](https://www.ruby-forum.com/t/ror-rest-http-put-xml-payload-option/84950/1 "2007-02-08T20:36:01Z")

</div>

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  
controller.

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?

Thanks!

Mark Murphy  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Mark\_Murphy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b9bd4f/32.png) [@Mark\_Murphy](https://www.ruby-forum.com/u/Mark_Murphy)\
**Post date:** [February 8, 2007, 9:03pm UTC](https://www.ruby-forum.com/t/ror-rest-http-put-xml-payload-option/84950/2 "2007-02-08T21:03:04Z")

</div>

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.

MLM
