Skip to content
Hoody.com

The KV Store atomic operations endpoints let you modify array values stored under a key without overwriting the entire array. Use these to append to, pop from, or remove individual elements of an array, including arrays nested under a JSON path. Each operation runs in a single database transaction so the resulting array state is always consistent.

All three endpoints share the same parameter set: a required db (database path), an optional table name, an optional JSON path to target a nested array, and an optional history flag for change tracking.

Append a value to an array stored under key. If a JSON path is provided, the value is appended to the nested array at that path instead.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
pathquerystringNoJSON path to nested array
historyquerybooleanNoEnable history tracking. Default: true

A JSON object containing the value to append. The body schema is open, so any JSON-serializable value can be passed.

{
"task": "review PR",
"priority": "high"
}
Terminal window
curl -X POST "https://proj-prod-abc123-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/kv/tasks/push?db=/hoody/databases/app.db&path=$.pending" \
-H "Content-Type: application/json" \
-d '{
"task": "review PR",
"priority": "high"
}'
{
"success": true,
"key": "tasks",
"path": "$.pending",
"length": 4
}

Remove and return the last element from an array stored under key. If a JSON path is provided, the operation targets the nested array at that path.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
pathquerystringNoJSON path to nested array
historyquerybooleanNoEnable history tracking. Default: true

This endpoint takes no request body.

Terminal window
curl -X POST "https://proj-prod-abc123-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/kv/tasks/pop?db=/hoody/databases/app.db&path=$.pending" \
-H "Content-Type: application/json"
{
"value": {
"task": "review PR",
"priority": "high"
},
"key": "tasks",
"path": "$.pending",
"remaining": 3
}

Remove a single element from an array stored under key. Identify the element either by index (zero-based position) as a query parameter, or by a value match in the request body. If a JSON path is provided, the operation targets the nested array at that path.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
pathquerystringNoJSON path to nested array
indexqueryintegerNoArray index to remove
historyquerybooleanNoEnable history tracking. Default: true

A JSON object carrying the value to match and remove when index is not supplied. The body schema is open, so any JSON-serializable value is accepted and the first element equal to it is removed.

{
"task": "review PR",
"priority": "high"
}
Terminal window
curl -X POST "https://proj-prod-abc123-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/kv/tasks/remove?db=/hoody/databases/app.db&path=$.pending&index=0" \
-H "Content-Type: application/json" \
-d '{
"task": "review PR",
"priority": "high"
}'
{
"success": true,
"key": "tasks",
"path": "$.pending",
"removed": true,
"length": 2
}