I'm trying to create a RESTful API and document. However I seem to be getting a weird error I can't figure out how to fix.
This works:
curl --header "Accept: application/json" http://api.example.com/v1/method.php?key=test
However if you remove the ".php" extension and run this:
curl --header "Accept: application/json" http://api.example.com/v1/method?key=test
You should get a 406 error if you run it. Now if you drop the header that the curl is sending, both of the requests work just fine. However the documentation tool(swagger) I'm using requires it.
Here is my rewrite rule (found here):
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Try
Your operation did not fail.
Your backend service is saying that the response type it is returning is not provided in the Accept-Type HTTP header in your Client request.
Ref: http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
http://en.wikipedia.org/wiki/HTTP_status_code -> 406