Content Negotiation: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 14: Line 14:


== Content-Language Negotiation ==
== Content-Language Negotiation ==
Aside from negotiating the [[Content-Type Header | Content-Type]] of the response, HTTP also allows clients to negotiate the language of the returned data. This is done in the same way as above but then with the [[Accept-Language Header]].
Aside from negotiating the [[Content-Type Header | Content-Type]] of the response, HTTP also allows clients to negotiate the [[Content-Language]] of the returned data. This is done in the same way as above but then with the [[Accept-Language Header]].
 
== Best Practices ==
To make life easier for everyone we recommend following these practices:
 
=== Return a <code>text/html</code> Response by Default ===
Primarily if the request contains no Accept header or if the client asks for <code>*/*</code>. Ideally this should show a browser friendly interface or an [[API Viewer]].
This allows users to use their browser to explore the data and makes it mandatory for clients to specify what response they want, an important step needed to allow [[Backward Compatibility]].
 
=== Return a List of Supported Formats When Sending a 406 Not Acceptable ===
Ideally these should link to [[API Viewer]] screens that show the response so users can explore the API in their browser.

Navigation menu