Skip to content

Public API: Get a List of Tasks

Isaiah Fisher edited this page Dec 17, 2024 · 1 revision

Getting a list of tasks assigned to a particular user

The GET https://api.pneumatic.app/v3/tasks returns all the tasks assigned to a user whose id you pass in as a parameter named assigned_to. The other two parameters are limit and offset and can be omitted, but then again, assigned_to is also optional and without it Pneumatic will just return a list of all the active tasks currently in the system.

param required description
assigned_to no the id of the user whose tasks you want to get
limit no the page size
offset no the starting page

Here's what it looks like in Python:

import requests
import json


api_key = "g-DvJPOP8dJ9qme2kfQFUzwHGOIZTWDY"
#template_id = int(input("enter a template id: "))

headers = {
  'Authorization': f'Bearer {api_key}'
}

r = requests.get(
    f'https://api.pneumatic.app/v3/tasks',
    headers=headers,
    params = {
        'assigned_to': 4113
    }
)

if r.ok:
  tasks = r.json()
  print(json.dumps(tasks, indent=4))

The above code will essentially print a list of tasks:

[
    {
        "id": numeric task id,
        "name": "Task name",
        "workflow_name": "Workflow name",
        "due_date_tsp": null,
        "date_started": "date string",
        "date_started_tsp": time stamp,
        "date_completed": null,
        "date_completed_tsp": null,
        "template_id": numeric template id,
        "template_task_id": numeric template task id,
        "is_urgent": true/false
    },
    {
        "id": numeric task id,
        "name": "Task name",
        "workflow_name": "Workflow name",
        "due_date_tsp": null,
        "date_started": "date string",
        "date_started_tsp": time stamp,
        "date_completed": null,
        "date_completed_tsp": null,
        "template_id": numeric template id,
        "template_task_id": numeric template task id,
        "is_urgent": true/false
    },
...
]

Not with this particular endpoint, you don't get a json with a results field, you just get the list.