Create a task for an entity. Give task_type_id and entity_id. The task type must be for the type of the entity. The default name is main. You can give assignees, a list of person identifiers. A bot made for previews cannot be an assignee. You must be an administrator or a manager of the project of the entity. The task gets the project of the entity. The route ignores the project_id of the body.
POST
/data/tasks
curl
curl -X POST "http://api.example.com/data/tasks" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"task_type_id": "a24a6ea4-ce75-4665-a070-57453082c25",
"entity_id": "b24a6ea4-ce75-4665-a070-57453082c25",
"assignees": [
"c24a6ea4-ce75-4665-a070-57453082c25"
]
}'
import requests
url = "http://api.example.com/data/tasks"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json"
}
params = {}
payload = {
"task_type_id": "a24a6ea4-ce75-4665-a070-57453082c25",
"entity_id": "b24a6ea4-ce75-4665-a070-57453082c25",
"assignees": [
"c24a6ea4-ce75-4665-a070-57453082c25"
]
}
response = requests.post(
url,
headers=headers,
params=params,
json=payload
)
response.raise_for_status()
if response.content:
print(response.json())
Request examples
{
"task_type_id": "a24a6ea4-ce75-4665-a070-57453082c250",
"entity_id": "b24a6ea4-ce75-4665-a070-57453082c250",
"assignees": [
"c24a6ea4-ce75-4665-a070-57453082c250"
]
}
Response examples (201)
{
"id": "d24a6ea4-ce75-4665-a070-57453082c250",
"task_type_id": "a24a6ea4-ce75-4665-a070-57453082c250",
"entity_id": "b24a6ea4-ce75-4665-a070-57453082c250",
"assignees": [
"c24a6ea4-ce75-4665-a070-57453082c250"
]
}