-
-
Notifications
You must be signed in to change notification settings - Fork 771
Closed
Labels
Milestone
Description
API design:
POST /db/table/row-pks/-/update
{
"field": "updated_value"
}
Only the fields that you pass will be updated.
Maybe this is the wrong design though? The design for insert currently looks like this:
POST /db/table/-/insert
Authorization: Bearer xxx
Content-Type: application/json
{
"row": {
"id": 1,
"name": "New name"
}
}
I could use the same format for /-/update
, but in this case the API doesn't require you to pass every field so "row"
doesn't seem like the right key.
I think I'll go with this:
POST /db/table/1/-/update
Authorization: Bearer xxx
Content-Type: application/json
{
"update": {
"name": "New name"
}
}
The benefit of having an "update"
key is that it allows me to use other keys in the future. Maybe a "alter": true
key to indicate that new columns should be added if they are missing.