github
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/issues/1851#issuecomment-1289712350 | https://api.github.com/repos/simonw/datasette/issues/1851 | 1289712350 | IC_kwDOBm6k_c5M33Le | 9599 | 2022-10-24T22:28:39Z | 2022-10-27T23:18:48Z | OWNER | API design: (**UPDATE: this was [later changed to POST /db/table/-/insert](https://github.com/simonw/datasette/issues/1851#issuecomment-1294224185)) ``` POST /db/table Authorization: Bearer xxx Content-Type: application/json { "row": { "id": 1, "name": "New record" } } ``` Returns: ``` 201 Created { "row": { "id": 1, "name": "New record" } } ``` You can omit optional fields in the input, including the ID field. The returned object will always include all fields - and will even include `rowid` if your object doesn't have a primary key of its own. I decided to use `"row"` as the key in both request and response, to preserve space for other future keys - one that tells you that the table has been created, for example. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1421544654 | |
https://github.com/simonw/datasette/issues/1851#issuecomment-1289713513 | https://api.github.com/repos/simonw/datasette/issues/1851 | 1289713513 | IC_kwDOBm6k_c5M33dp | 9599 | 2022-10-24T22:29:58Z | 2022-10-24T22:30:15Z | OWNER | Interesting open question: how should validation errors (if any) be returned? The two forms of validation I can think of at first are: - Missing keys which are marked as `not null` in the schema - Keys that do not match to existing columns (if you didn't pass `"alter": true`, an option I am considering) | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1421544654 |