Use the Simplest Content Type We Can
Learn the content type we should be using in the APIs.
We'll cover the following...
The HTTP Accept
header allows for a wide variety of configurations for how a client can tell the API what sort of content type it wants back (the Content-Type
header is for the server to specify what it’s sending). We can ignore it altogether and always serve JSON, or we could require the content type to be application/json
, create our own custom content type for all our resources, or even make a content type for each resource. The possibilities and associated carrying costs are endless.
We would not recommend ignoring the Accept
header. It’s not unreasonable to ...