Requirements
- A Fragment account (preferably a dev environment)
- Make sure you have the super admin role
1. Create an API token
In the app, go toSettings > Developers
and create a token. We’ll call it token
below.
For convenience, you can set an environment variable (in your .bashrc
file for example):
quickstart.py
2. Verify authentication
To verify your authentication, make a request to theGET /v1/accounts/me
endpoint.
quickstart.py
3. Create your first task
Let’s create a first task with- 2 standard fields:
title
(required) andurl
(optional) - a custom field:
country
quickstart.py
uid
key stores the task unique identifier (a UUID). We’ll use it to find the task later.
Notice how the task was created with
- default status
TODO
- default due date (
due_at
) set to the current date and time.
Unless you have already configured queues on Fragment, the task will not enroll in any task queue and won’t appear in the backlog page.You can search for “My first task” in the search bar to find the task.
4. Get the task by its UUID
To retrieve the task we just created, we can use the GET /v1/tasks/{uid}
endpoint.
quickstart.py
5. Search tasks by country
We can also search for tasks.
For example, let’s search for tasks with the country
field set to FR
using the GET /v1/tasks
endpoint.
quickstart.py
items
key.
To learn more about pagination, see Pagination.
5. Update task status
To update the task, we can use thePATCH /v1/tasks/{uid}
endpoint.
For example, let’s complete the task by updating its status
to DONE
.
quickstart.py
Notice how
status
is a native field and doesn’t need to be nested in the fields
key like title
, url
, or country
.6. (Optional) Add a comment
To add a comment to the task, we can use thePOST /v1/tasks/{uid}/comments
endpoint.
For example, let’s add a comment to the task.
quickstart.py
Recap & full code
To recap what we’ve done- We’ve created an API token and verified authentication
- We’ve created a task and retrieved it by its
uid
- We’ve searched for tasks by
country
- We’ve updated the task status
- We’ve added a comment to the task
quickstart.py
Troubleshooting
- 401 Unauthorized: check your token and
Authorization: Bearer
header. - 422 Unprocessable Entity: verify payload shape; see the Task object.
- 429 Too Many Requests: reduce frequency and add retries; see Rate limiting.