Open jrf0110 opened 11 years ago
?links=true
option to have resources return links to sub-resources.RE: status codes http://httpstatus.es/
I'm all for the better codes. I want to take a shot at producing links via the description yamls at some point; we'll get to it.
404 on GET /session
when there is no session
422 on malformed requests
We should get rid of the whole { error: /* .. */, data: /* ... */ }
thing.
it's much easier client-side if you only have one at a time.
would you think, instead, the entire body is an error object if 4xx/5xx, and a data object if 200/201?
We might not want to make those changes, especially at this point. Since it will mean that the products will need to change the way that they work with the API, which won't be progressive.
if we go this route - clients have to check the http code type before handing the response data... Instead of just checking if an error object exists. Which is the fastest thing to do. We want to make it super easy to adopt and work with the API.
Sent from my iPhone
On Feb 18, 2013, at 4:03 PM, Paul Frazee notifications@github.com wrote:
would you think, instead, the entire body is an error object if 4xx/5xx, and a data object if 200/201?
— Reply to this email directly or view it on GitHub.
most networking libraries, jQuery, RestKit, etc., have built in support for checking the http status code and triggering the error
handler for anything in the 4xx-5xx range. which means that writing clients is actually a lot easier if we use http properly and have the status code indicate what type of response it is.
routes now respond with 204 codes when no content is sent
Yeah, we've actually been complicating things by not using built-in error handling. It's an artifact of APIs past!
So, there's lots of little, non-critical specification-related problems that are getting brought up. Let's use this thread to organize our thoughts on how we can improve the API in regards to the HTTP specification, RESTful best practices, and the things we like from well-tested and popular APIs.