i don't wanna be too hyperbolic but if your API throws an error but uses a 200 response code with a body like this:
{
"status": 408,
"error": "Request timeout"
}
i wish ill upon your extended family :)
i don't wanna be too hyperbolic but if your API throws an error but uses a 200 response code with a body like this: { i wish ill upon your extended family :) 4 comments
I remember explanations that some HTTP client libraries make it much harder to access the response body when the code isn't 200. They'd just return an error like "duh, your request failed". |
VKontakte API does exactly this. It's very much decoupled from the HTTP layer to begin with. The status code is always 200. You can use either POST or GET with any API method. You can pass parameters in the query string, as x-www-form-urlencoded, or split them between the two. As long as they end up in $_REQUEST on the server, it doesn't care.