Batch POST/PUT with REST?

Is there any facility in RoR to create/edit multiple objects with a single call.

I am developing an application which allows users to upload data via a REST API. The only issue is that people will be creating 1000's of records at a time. Is there some way using standard REST to make a single XML document with all those records, and import them over a single HTTP transaction, rather than opening and breaking down 1000's of connections.

Something like: <records>   <record>     .....   </record>   <record>     .....    </record> </records>

Similarly, is there way to do a batch update where the XML document has the id as an attribute of the record?

Thanks,

Andrew

REST: yes, Rails' default REST conventions, no. You'd want to create a separate action to handle arrays of XML.

map.resources :records, :collection => {:import => :post}

POST records/import

params[:records] in the controller action would be the array of xml. From there, you can loop through params[:records] and create them.

Now, I don't know how long creating and validating 1000 records at a time would take, but it may be a good idea to make this into a separate resource that tracked which records failed or were invalid.

map.resources :records map.resources :imports, :path_prefix => 'records/'

POST records/imports, store the xml as a file somewhere, and give the client an ID so they can check the status later. Then use some queue (bj, starling, beanstalk) to handle this asynchronously, and let the user know if the import has problems, and give them an option to resolve them.