diff --git a/api.rst b/api.rst index 2dea57d3f..3ec32d019 100644 --- a/api.rst +++ b/api.rst @@ -889,7 +889,7 @@ To create a row in a database table post a JSON object whose keys are the names { "col1": "value1", "col2": "value2" } -If the table has a primary key, the response will include a :code:`Location` header describing where to find the new object. If the table is write-only then constructing the Location header will cause a permissions error. To successfully insert an item to a write-only table you will need to suppress the Location response header by including the request header :code:`Prefer: return=minimal`. +If the table has a primary key, the response can contain a :code:`Location` header describing where to find the new object by including the header :code:`Prefer: return=headers-only` in the request. Make sure that the table is not write-only, otherwise constructing the :code:`Location` header will cause a permissions error. On the other end of the spectrum you can get the full created object back in the response to your request by including the header :code:`Prefer: return=representation`. That way you won't have to make another HTTP call to discover properties that may have been filled in on the server side. You can also apply the standard :ref:`v_filter` to these results. diff --git a/releases/upcoming.rst b/releases/upcoming.rst index d35310ceb..81c3a8a57 100644 --- a/releases/upcoming.rst +++ b/releases/upcoming.rst @@ -16,6 +16,9 @@ Added * Allow :ref:`s_procs_variadic`. |br| -- `@wolfgangwalther `_ +* Allow sending the header ``Prefer: headers-only`` to get a response with a ``Location`` header. See :ref:`insert_update`. + |br| -- `@laurenceisla `_ + * Allow :ref:`connection_poolers` such as PgBouncer in transaction pooling mode. |br| -- `@laurenceisla `_ @@ -55,4 +58,8 @@ Changed |br| -- `@laurenceisla `_ * Modified the default logging level from ``info`` to ``error``. See :ref:`log-level`. - |br| -- `@steve-chavez `_ \ No newline at end of file + |br| -- `@steve-chavez `_ + +* POST requests for insertions no longer include a ``Location`` header in the response by default and behave the same way as having a + ``Prefer: return=minimal`` header in the request. This prevents permissions errors when having a write-only table. See :ref:`insert_update`. + |br| -- `@laurenceisla `_