Read, update, and delete a task
Continue with the task you created in Create your first task. Read it by its generated identifier, mark it complete, and remove it when the work is finished.
What you will do
By the end of this guide, you will have:
- read the stored
Build with TaruviBasetask; - changed its
donevalue from false to true; - verified the updated value; and
- deleted the task and confirmed that its identifier no longer resolves.
Before you begin
Complete Create your first task, or prepare the same starting state:
- a non-production app with a
taskstable; - a record whose
titleisBuild with TaruviBaseand whosedonevalue is false; - the generated record identifier, referred to below as
TASK_ID; and - a connected JavaScript, Python, REST, or TaruviBase Console interface with permission to read and change that record.
If you no longer have the returned identifier, open Datatables, select
tasks, and copy the id from the Build with TaruviBase row. Treat the value as
opaque; do not calculate or reconstruct it.
For Python, open a new client with with create_taruvi_client() as client: and
keep that context open while you run the Python operations below.
1. Read your first task
Replace TASK_ID with the task's id from Create your first task.
- JavaScript SDK
- Python SDK
- REST API
- TaruviBase Console
await database.from('tasks').get('TASK_ID').execute();
client.database.get("tasks", "TASK_ID")
/api/apps/$TARUVI_APP_SLUG/datatables/tasks/data/$TASK_ID/curl "$TARUVI_SITE_URL/api/apps/$TARUVI_APP_SLUG/datatables/tasks/data/$TASK_ID/" \
-H "Authorization: Api-Key $TARUVI_API_KEY"
200Returns one record object in data without a total field.
- Open your app and select Datatables.
- Open
tasks, then select Data. - Find the row whose
idequalsTASK_ID.
The record has the identifier you supplied and these stored values:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Build with TaruviBase",
"done": false
}
Your id may differ.
Reading the task with Refine
In a Refine application, useOne reads the same task:
useOne({
resource: 'tasks',
id: 'TASK_ID',
});
Continue step 2 with JavaScript, Python, REST, or TaruviBase Console. For Refine mutation support and its current interface boundaries, use the Refine integration guide.
2. Mark the task complete
Use the same TASK_ID and send only the field that changes.
- JavaScript SDK
- Python SDK
- REST API
- TaruviBase Console
await database.from('tasks').get('TASK_ID').update({done: true}).execute();
client.database.update(
table_name="tasks",
record_id="TASK_ID",
data={"done": True},
)
/api/apps/$TARUVI_APP_SLUG/datatables/tasks/data/$TASK_ID/curl -X PATCH "$TARUVI_SITE_URL/api/apps/$TARUVI_APP_SLUG/datatables/tasks/data/$TASK_ID/" \
-H "Authorization: Api-Key $TARUVI_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"done": true
}
JSON
200Returns the updated task record.
- Open the row action for
TASK_IDand select Edit. - Set
doneto true. - Select Update Record.
3. Verify the update
Repeat the read from step 1 with the same TASK_ID, or refresh the row in
TaruviBase Console. The stored record now has done set to true:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Build with TaruviBase",
"done": true
}
4. Delete the completed task
Use the same TASK_ID to remove the record.
- JavaScript SDK
- Python SDK
- REST API
- TaruviBase Console
await database.from('tasks').delete('TASK_ID').execute();
client.database.delete(table_name="tasks", record_id="TASK_ID")
/api/apps/$TARUVI_APP_SLUG/datatables/tasks/data/$TASK_ID/curl -X DELETE "$TARUVI_SITE_URL/api/apps/$TARUVI_APP_SLUG/datatables/tasks/data/$TASK_ID/" \
-H "Authorization: Api-Key $TARUVI_API_KEY"
204Returns no response body.
- Open the row action for
TASK_IDand select Delete. - Review the task shown in Confirm Delete Record.
- Select Delete Record.
5. Confirm the task is gone
Repeat the read from step 1 with TASK_ID. JavaScript and Python throw
NotFoundError, while REST returns HTTP 404. In TaruviBase Console, refresh
Data and confirm that no row with TASK_ID remains.
You completed the task-list data flow
Your application used the same site, app, table, record identifier, and authorization context throughout the flow: