Example
In this first example, the task has the default fieldstitle
, url
, and custom fields ticket_id
and country
.
Custom fields
The task stores its custom attributes in thefields
key, including two default fields:
title
- A human-readable title for the taskurl
- An optional URL that provides additional context or links to related resources. The Fragment player will open this URL when the task is opened in the chrome extension.
snake_case
for custom field attributes though any valid JSON key is allowed.
The API will accept any valid JSON.
No type validation is performed on the custom fields. You are responsible for ensuring the data type is consistent.
Relevant API endpoints
POST /tasks
: create a taskPUT /tasks/:id
: create or update a task (idempotent)PATCH /tasks/:id
: update a taskPOST /tasks/batch
: bulk create tasksPUT /tasks/batch
: bulk create or update tasks (idempotent)PATCH /tasks/batch
: bulk update tasks
Create tasks
Use thePOST /tasks
endpoint to create the task in Fragment.
create.py
Upsert tasks (idempotent)
To avoid double task creation in case of retries and network errors, you can use thePUT /tasks/{uid}
endpoint instead of POST /tasks
.
The PUT endpoint is idempotent and requires you to generate a task ID that is stable across retries.
For example:
upsert.py
Update tasks
When you update a ticket in your existing system or simply need to update the task in Fragment because of some event, you might need to update the corresponding task in Fragment. Use thePATCH /tasks/{uid}
endpoint to update the task in Fragment.
For example
update.py
Bulk upserts
If you have a high volume of tickets, you might want to create them in bulk. Relevant endpointsPOST /tasks/batch
: create the tasks in Fragment in bulk.PUT /tasks/batch
: create or update the tasks in Fragment in bulk.PATCH /tasks/batch
: update the tasks in Fragment in bulk.
Schema
Task schema, same as Task Model.
Task Status Enum.
Available options:
TODO
, STARTED
, DONE
Task Status Enum.
Available options:
TODO
, STARTED
, DONE
User Schema.
Task schema, same as Task Model.