From 216550e9590e8c55d94b49e3018f0728dfcaaa26 Mon Sep 17 00:00:00 2001 From: Joe Nelson Date: Sun, 20 Nov 2016 21:39:35 -0800 Subject: [PATCH] Content negotiation --- api.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/api.rst b/api.rst index 73fa46cea..1cceabdf1 100644 --- a/api.rst +++ b/api.rst @@ -175,6 +175,24 @@ Note that the larger the table the slower this query runs in the database. The s Response Format --------------- +PostgREST uses proper HTTP content negotiation (`RFC7231 `_) to deliver the desired representation of a resource. That is to say the same API endpoint can respond respond in different formats like JSON or CSV depending on the client request. + +Use the Accept request header to specify the acceptable format (or formats) for the response: + +.. code-block:: http + + GET /people HTTP/1.1 + Accept: application/json + +The current possibilities are + +* \*/\* +* text/csv +* application/json +* application/openapi+json + +The server will default to JSON for API endpoints and OpenAPI on the root. + Singular or Plural ------------------