Close

Content Negotiation

[Updated: Sep 3, 2017, Created: Feb 9, 2016]

HTTP Web 

Content negotiation is a technique described in the HTTP specification.

It allows a client to make a more specific request regarding what media type they are expecting in the response so that server selectively process the request and produce the requested media type.


Clients include this information in the header with key 'Accept'. For example:

Accept: text/html; q=1.0, text/*; q=0.8, image/gif; q=0.6, image/jpeg; q=0.6, image/*; q=0.5, */*; q=0.1


At the same time client also specifies what content type in the message body (typically in POST or PUT request) they are sending to the server so that the server can selectively consume and process the message body.

Content-Type: application/json



Reference:
Content Negotiation Specs