Skip to content

Commit

Permalink
Add content negotiation docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
tisto committed Jul 11, 2015
1 parent 79e5bb7 commit 0579f5a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/source/content-negotiation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Content Negotiation
===================

`Content negotiation`_ is a mechanism defined in the `HTTP specification`_ that makes it possible to serve different versions of a document (or more generally, a resource representation) at the same URI, so that user agents can specify which version fit their capabilities the best.

The user agent (or the REST consumer) can ask for a specific representation by providing an Accept HTTP header that lists acceptable media types (e.g. JSON)::

GET /
Accept: application/json

The server is then able to supply the version of the resource that best fits the user agent's needs. This is reflected in the Content-Type header::

HTTP 200 OK
Content-Type: application/json

{
'data': ...
}

.. _`Content negotiation`: http://tools.ietf.org/html/rfc7231#section-5.3

.. _`HTTP specification`: http://tools.ietf.org/html/rfc7231

1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Contents
:maxdepth: 3

introduction
content-negotiation

.. hydra
.. item
Expand Down

0 comments on commit 0579f5a

Please sign in to comment.