POST /tasks
Description
Creates a new task and returns a task object with the ID of a new task
The route handles the POST request made to the /tasks
path.
HTTP method | Route |
---|---|
POST | /tasks |
Payload
The server side expects to receive a json object with the next properties:
Name | Type | Description |
---|---|---|
targetId | number | Optional. The ID of the future target task where a new task will be added. |
parent | number | Optional. The ID of the parent task. |
project | number | Optional. The ID of the project to which a new task should be added. |
reverse | boolean | Optional. Defines the position where a new task will be added: true, if the task is added before the target task; otherwise, false (default). |
task | object | Required. The task object an example of which you can find here tasks. |
Example:
{
"parent": 10,
"project": 1,
"reverse": false,
"targetId": 10,
"task": {
"text": "My task",
//...other values
}
}
Response
The route returns a json object with the ID of a new task.
Example:
{
"id": 12
}
The HTTP status code shows whether the request succeeds (response.status == 200) or fails (response.status == 500).
Related articles: