openreferral / api-specification

This is the working repository for Open Referral's Human Services Data API protocols.
https://openreferral.readthedocs.io/en/latest/hsda/
Other
29 stars 13 forks source link

Error & Status Codes #3

Open kinlane opened 7 years ago

kinlane commented 7 years ago

Need to come up with the standard for returning error and status codes -- there is no plan so far. I'd like to see this span a standard error responses structure, as well as application of HTTP status codes.

HTTP Status Success

HTTP Status Redirection

HTTP Status User Error

HTTP Status Server Error

switzersc commented 7 years ago

@kinlane what are the next steps you're thinking for this? When you say "application of HTTP status codes" ,do you mean implementation in the API layer or documentation in the spec, or something else? Just looking to see if/how I can contribute here.

kinlane commented 7 years ago

My goal is to have the OpenAPI provide guidance for practitioners beyond just basic 200, 404, and 500. Providing real examples of mature responses. So to answer you, I guess d) all the above. I wrote this as I was designing and deploying the demo. Which I was starting to make reflect in the OpenAPI for the spec, which will translate into the documentation that gets generated.

At first I'm just looking to suggest a handful of core reponse codes, with basic guidance in spec, but links to educate implementers about proper usage -- we'll see where goes from there.

kinlane commented 7 years ago

I'm suggesting that for v1.1 we only provide guidance on successful 200 response providing HSDS compliant JSON.

In v1.2 I will provide more guidance on further HTTP status code recommendations and possibly common schema for errors.

NeilMcKLogic commented 7 years ago

I like the implementation of a reasonable number of these error codes. It is more informative to human users (we devs) and also lets us more programatically respond to different error scenarios beyond a simple binary choice of "it succeeded" and "it failed".

kinlane commented 7 years ago

@NeilMcKechnie precisely. As a developer, I really appreciate having this stuff well defined so when I have my blinders on I can just implement. The HTTP status code vocabulary is robust, and it just makes sense for us to provide guidance for developers to help them ensure their implementations are as communicative as possible.