Is it OK to return HTML from a RESTful JSON API?
On my current project I am responsible for the implementation of a service
which involves the consumption of newly created RESTful JSON APIs. One API
sends a content-type of HTML for some responses, even a HTML body. To me
this is clearly the wrong approach and can never be justified.
Throughout the project this same practice has been applied across two
different vendors and two different services. I found myself having to
justify why the services needed to be changed. The vendors stated that the
client should cope with this and even my REST library of choice has been
questioned (RestEasy) because it doesn't cope with this by default 'out
the box'.
This has been a major point of frustration. I can't find many references
to back up my argument, I assume this is because the point is mute as it's
so obvious.
The question is am I missing something? I'm I being pedantic about this?
Is it OK to have a RESTful JSON API that doesn't have a context-type of
application/json? References would be appreciated.
No comments:
Post a Comment