-
Notifications
You must be signed in to change notification settings - Fork 12
Public API: Get a Task
Isaiah Fisher edited this page Dec 17, 2024
·
1 revision
The GET https://api.pneumatic.app/v2/tasks/<id>
lets you get all the info about a specific task (you're gonna need to know its id).
There's no params here, you just tack the task id at the end of the handle. You can find it in the url of the task you're interested in, for example.
Whatever the case may be, you just pass it in and get the lowdown on the task. 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}'
}
task_id = 164570
r = requests.get(
f'https://api.pneumatic.app/v2/tasks/{task_id}',
headers=headers
)
#g-DvJPOP8dJ9qme2kfQFUzwHGOIZTWDY
if r.ok:
the_task = r.json()
print(json.dumps(the_task, indent=4))
The json you get in response looks something like this:
{
"id": int,
"name": str,
"description": str,
"date_started": str,
"date_completed": null | str,
"due_date": null | str,
"is_completed": bool,
"is_urgent": bool,
"require_completion_by_all": bool,
"performers": [int], // users ids
"delay": null | {
"id": int,
"duration": str,
"start_date": str,
"end_date": str,
"estimated_end_date": str
},
"output": [
{
"id": int,
"task_id": int | null,
"kickoff_id": int | null,
"type": str, // string|text|radio|checkbox|date|url|dropdown|file|user
"api_name": str,
"name": str,
"value": str,
"attachments": [
{
"id": int,
"name": str,
"url": str
}
],
"selections": [
{
"id": int,
"api_name": str,
"value": str,
"is_selected": bool
}
]
}
]
}
Essentially it's all the information there is in the system about the task.