0

I'm using Zend_Rest_Controller to implement a RESTful API.

The GET action works fine, for example when I make the /user/id/1 request the :id parameter is present when I use $request->getParams().

However, when I make a POST request to /user, the postAction() is called just fine but there is no POST data in $request->getParams() or $request->getPost(). $request->getRawBody() shows that they are getting to the server fine though.

Is there any reason why ZF might not be populating the request object with these params? How do I access them?

Simon Robb
  • 1,668
  • 1
  • 14
  • 25

1 Answers1

0

Double check the content type on the http headers of the request. Should be multipart/form-data.

slash28cu
  • 1,614
  • 11
  • 23
  • Thanks @slash28cu the request is coming from backbone.js so the request is application/json, but I just tried it with multipart/form-data from cURL and it's no better. – Simon Robb Nov 01 '12 at 03:38
  • Also just tried x-www-form-urlencoded in cURL and that worked fine - is there some way I can specify the API to allow the application/json type request? – Simon Robb Nov 01 '12 at 03:56