Content negotiation is an important part of REST API. It makes it possible to reveal a resource in various formats and allow the client choose which is best. A client can ask for the resource in a specific format using the Accept header. With this, the server serve the request to match the specific format and if the format is not supported, it returns a 406 Not Acceptable.
We saw examples in this article(Building a Simple Web API) that all the responses are JSON, but we can also get XML format too.