Sure can! You can post XML (the same format as the @asset.to_xml
output) if you set the content-type to application/xml, or append a
.xml extension. ActiveResource works like this. There' s a param
parser for Mime::XML that parses the xml and returns a hash in the
same format, so your controller code doesn't need to change. All you
need is a respond_to block for the response.
I have an experimental plugin for JSON support:
there are a few issues:
* It uses the fjson gem (fast json parser written in c). I seem to
recall rails has this now, buy converting json to YAML and returning
* json has no date/time literal. If you look at my plugin, it looks
for any strings in the xmlschema format and parses them to date/times.
But, this is a hack. Currently there's no standard for times in
json, so I don't really think json is suitable for this task. You can
come up with your own convention if you like, or just use XML and get
on with your app.
* set up a simple json param parser. This would be a good guide if
you wanted a simple way to process other common formats, for example.