-
Notifications
You must be signed in to change notification settings - Fork 19
Public API: Get a Task
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_started_tsp': float, // timestamp in seconds
'date_completed': null | str,
'date_completed_tsp': float, // timestamp in seconds
'due_date': null | str, // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
'due_date_tsp': int, // timestamp in seconds
'is_completed': bool,
'is_urgent': bool,
'require_completion_by_all': bool,
'contains_comments': bool, // true if there are comments
"performers": [
{
"type": "user"|"group",
"source_id": int, // the group or user id
}
],
'delay': null | {
'id': int,
'duration': str,
'start_date': str, // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
'start_date_tsp': str, // timestamp in seconds
'end_date': str, // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
'end_date_tsp': str, // timestamp in seconds
'estimated_end_date': str, // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
'estimated_end_date_tsp': str, // timestamp in seconds
},
"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, // the string representation of the value
"user_id": int, // for user fields
"attachments": [
{
"id": int,
"name": str,
"url": str
}
],
"selections": [
{
"id": int,
"api_name": str,
"value": str,
"is_selected": bool
}
]
}
]
'workflow': {
"id": int,
"name": str,
"template_name": str, // workflow.template.name или workflow.legacy_temlate_name
"status": int,
"date_completed": str,
'date_completed_tsp': float, // timestamp
"current_task": int,
},
"checklists_total": int,
"checklists_marked": int,
"checklists": [
{
"id": int,
"api_name": str,
"selecions": [
{
"id": int,
"api_name": str,
"value": str,
"is_selected": bool
}
]
}
],
"sub_workflows": [
{
"id": int,
"name": str,
"status": int,
"owners": [int],
"date_created": str, // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
"date_created_tsp": str, // timestamp
"due_date": str | null, // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
"due_date_tsp": float, // timestamp
"tasks_count": int,
"current_task": int,
"is_external": bool,
"is_urgent": bool,
"workflow_starter": int | null // null if is_external
"current_task": int,
"task": {
"id": int,
"name": str,
"number": int,
"due_date": str | null, // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
"due_date_tsp": float, // timestamp
"date_started": str, // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
"date_started_tsp": float, // timestamp
"performers": [
{
"type": "user"|"group",
"source_id": int, // the user or group id
}
],
"checklists_total": int,
"checklists_marked": int,
"delay": {
"duration": str,
"start_date": str,
"start_date_tsp": float, // timestamp
"end_date": str, // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
"end_date_tsp": float, // timestamp
"estimated_end_date": str // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
"estimated_end_date_tsp": float, // timestamp
},
},
"passed_tasks": [
{
"id": int,
"name": str,
"number": int
}
],
"template": {
"id": int,
"name": str,
"is_active": bool,
"wf_name_template": str | null,
}
}
]
}Essentially it's all the information there is in the system about the task. Note that it also includes information about any embedded workflows that may have been launched from the task (the sub_workflows key). Last but not least, the list of performers is a list of objections (python dictionaries) each of which contains the id of the performer and its type (user or group)