1

Is it possible to POST "url encoded" parameters to a remote web service instead of JSON or XML ?

My rails application consumes a web service which takes URL encoded parameters (content-type: application/x-www-form-urlencoded) in POST requests and give JSON answers.

Is this kind of RESTful services common ?

Antoine
  • 1,782
  • 1
  • 14
  • 32

1 Answers1

2

When you make a hit to a JSON or XML web service using Ajax then the parameters are just getting encoded as either GET or POST, and is typically sent using the application/x-www-form-urlencoded content type anyway (see http://api.jquery.com/jQuery.ajax/ for an example specific to jQuery).

So, basically, yes, it is possible to send data in any format (JSON, XML, BSON etc.) in this manner.

Mike P
  • 2,797
  • 2
  • 21
  • 25
  • What would be a clean solution to achieve that with activeresource ? I haven't thought that much about that but I think I can just write a custom serializer. Does it seem to be an overkill ? – Antoine Feb 09 '12 at 16:05