Content negotiation

Content negotiation is an HTTP technique to identify the "best available" response for a client request when multiple responses may be available on the server.

Note

The RFC 2616 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html) specification for HTTP allows server-driven, agent-driven, and transparent negotiations. For the scope of this chapter, we focus on server-driven negotiations.

The negotiation between the client and the server is accomplished through a set of HTTP headers. These header fields are used by the client to express the desired content type or media type, this information is then used by the server to format the response in a way the client can understand:

Field

Description

Accept headers

These specify ...

Get Building Web Services with Microsoft Azure now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.