API Response Suggestions

So todays coding is all about standards but also about the wild west but also making the code that comes out of the wild west a standard (which a lot of it does).

I’m torn every time I look something up that I’m not sure about or would like to see if there is a new suggestion or standard to follow.

I will work a little harder to take an idea to make it work to a standard but there comes a point that it just to much to keep up with and the next time I touch my “future proofed” code, it will be different.

So I look at what the wild west is doing then what the best practice is and then what posts on stackoverflow say and usually I take the best suggestion on stackoverewflow that is as close to a standard I found and try and clean it up best as I can and then stop worrying about if its 100% right. The only times I change my mind is if a best practice of another technology needs it and it makes my life easier than if I ignore it, it’s seldom but it does happen.

The Best Practice / Wild West Talk:

The Best Practice:

http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api

The Suggestion of Best Practice:

http://jsonapi.org/format/

The “What I do” Best Practice:

http://stackoverflow.com/questions/12806386/standard-json-api-response-format

My 2 thoughts on this:

The Json API is pretty simple to implement, it seems to meet todays standards but is the extreme of Hypermedia Restful. Yes that new standards looks so nice but I’m sorry I’m building the API for our own app and know what I need, the overhead just isn’t worth it.

Suggestion #2 Standard JSON API

I do like using the HTTP Status Codes to better handle the type of Errors happening without depending on them solely for determining the state of our application. I do like the idea of just being able to check the HTTP Status first and then moving down to checking the error code of the response. Overall I think it gives the API a well rounded feel without it making it to complicated to know how the application is working plus it seems to better fit our current state with multiple different levels of coding standards and application structures with these legacy applications.



Leave a Reply

Your email address will not be published. Required fields are marked *