I am developing an API using CodeIgniter and the RestServer for CI (see below). I am also using the Firefox RestClient plugin to test the API.
What I am wondering is how to do the test post (what format).
Tried {“desc”:”value”} but it did not work. The API is not “seeing” the incoming post fields.
http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/
the post body doesn’t need to have a specific format, but the most convenient is to encode the body in the same way web browsers encode form data, specifically
Content-Type: application/x-www-form-urlencoded. In particular, theHostandContent-Lengthheaders are not optional, and theContent-Typeheader is usually needed to tell the server how to interpret the body. A well formed POST request will look like:It’s still up to the server to recognize the content-type header and parse the body that way.
Note that the data is after all the headers, not as part of the request path (in the first line).