JSON API content type makes exploring in the browser impossible

Since JSON API uses a custom content type, the result is you can’t just view a json api response in the browser. On Firefox on Linux at least, it prompts you to download the response body.

Perhaps setting Content-Disposition to inline would work?

Has anyone seen this before? What’s the workaround? I can’t be the first to discover this.

Edit: After some testing it appears Firefox and Safari are the only ones that download the response. Chrome and Opera display it as text.

I would suggest using a tool that is made for exploring APIs. For example, Advanced REST Client is easy to install and open source.

While it is true that no browser explicitly sends an Accepts header for our media type, it is not true that this should prevent viewing in a browser. It sounds like the implementation you’re using could be handling content negotiation more effectively. Basically, absent the client saying hey, I want an application/vnd.api+json representation of your resource, the server should send a text/plain or text/html representation. An API is no different than a website.

More information here:
https://tools.ietf.org/html/rfc7231#section-5.3.2