mirror of
https://github.com/simonw/datasette.git
synced 2026-07-08 16:44:34 +02:00
Document why upsert returns 200 where insert returns 201
An upsert may update existing rows without creating anything, so it deliberately does not claim resource creation with a 201. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GrHZSypDfMnym1tM5XJAFZ
This commit is contained in:
parent
e892c686c2
commit
6e17c51361
1 changed files with 1 additions and 1 deletions
|
|
@ -1944,7 +1944,7 @@ The above example will:
|
|||
|
||||
Similar to ``/-/insert``, a ``row`` key with an object can be used instead of a ``rows`` array to upsert a single row.
|
||||
|
||||
If successful, this will return a ``200`` status code and a ``{"ok": true}`` response body.
|
||||
If successful, this will return a ``200`` status code and a ``{"ok": true}`` response body. This is deliberately different from the ``201`` returned by :ref:`insert <TableInsertView>`: an upsert may update existing rows without creating anything, so it does not claim resource creation.
|
||||
|
||||
Add ``"return": true`` to the request body to return full copies of the affected rows after they have been inserted or updated:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue