-
Notifications
You must be signed in to change notification settings - Fork 11
Public API: Get All Templates
Isaiah Fisher edited this page Dec 5, 2024
·
2 revisions
To retrieve all the templates you have access to in your account, use the following endpoint:
GET https://api.pneumatic.app/templates
The extra parameters you can pass in, include ordering(default is by date, alternatively, templates can be ordered by name, put a minus before the sorting parameter (-date, -name) to sort the results in descending order), limit (how many templates you want to get back in one go) and offset (if you want to skip the first one or several templates that get returned)
This is sample Python code that retrieves all the templates from your account:
import requests
api_key = 'your_api_key'
headers = {
'Authorization': f'Bearer {api_key}'
}
r = requests.get('https://api.pneumatic.app/templates', headers=headers)
This will return a json structured as follows:
{
"count": 10,
"next": "str",
"previous": "str",
"results": [
{
"id": 1,
"name": "Sample Template",
"tasks_count": "int",
"performers_count": "str",
"template_owners": ["int"],
"is_active": "bool",
"is_public": "bool",
"is_embedded": "bool",
"description": "str",
"kickoff": {
"id": "int",
"description": "str",
"fields": [
{
"name": "str",
"type": "str",
"order": "int",
"is_required": "bool",
"description": "str",
"api_name": "str",
"selections": [
{
"id": "int",
"value": "str"
}
]
}
]
}
}
]
}
If you pass in the limit/offset parameters, the structure of the response is as follows:
{
"count": 123,
"next": "next page link", // If this is the last page then "next" is null
"previous": "prev page link", // If this is the first page then "previous" is null
"results": [...] // list of templates
}