Skip to main content

PUT /move

Description

Moves a task to the specified position and returns an empty json object

The route handles the PUT request made to the /move/{id} path. For more details about available operations, see the description of the operation property sent in the request body (see the Payload section below).

HTTP methodRouteQuery parameter
PUT/moveid

Query parameters

The query parameter is sent in the request line:

NameTypeDescription
idnumberRequired. The ID of the task to be moved. In case multiple tasks are requested to be moved, the id should be set to 0
info

When you move multiple tasks, make sure that the id is set to 0, otherwise (if set to another value), only one task (with this specified id value) will be moved.

Payload

The server expects to receive a json object with the next properties:

NameTypeDescription
idnumberOptional. The ID of the moved task. The parameter is required for the indent/unindent operation types.
parentnumberOptional. The ID of the parent task.
projectnumberOptional. The ID of the project to which a task belongs to.
targetIdnumberOptional. The ID of the target task where the moved task will be pasted.
operationstringRequired. A server-specific parameter. It indicates the operation type. Available operation types: "null" - moves a task to a specified position within the current project (see "move-task"), "indent", "unindent", "project" - moves a task to another project (see "move-task").
If a task is moved within one project (operation === null), the operation property is not mandatory in the payload.
reversebooleanOptional. The position where a task will be moved: before the target task (true) or after it (false by default).
batchobjectRequired. An array of IDs of all tasks that are moved. If a task has child items, only the task parent ID is included into the object.

Example:

{
"id": 5,
"targetId": 2,
"reverse": false,
"operation": null,
"batch": null
}

Examples of different operation types:

Details

operation === null In case one task is moved within the current project, its ID is sent in the request line and other properties are sent in the request body.
If a task is moved within one project, the operation property is not mandatory in the payload.

Payload example:

{
"targetId": 1,
"reverse": true,
"batch": null
}

To move multiple tasks within the same project:

  • In the request line, set the task ID value to 0
  • In the request body, add the batch property that contains IDs of tasks to be moved
  • Add other necessary properties in the request body

Payload example:

{
"targetId": 1,
"reverse": true,
"batch": [1, 2, 3]
}
Details

operation === "indent" || operation === "unindent" In case the request is sent for one indent/unindent operation, the task ID is sent in the request line and other task properties are sent in the request body.

Example:

{
"parent": 2,
"targetId": 2,
"operation": "indent"
}
multiple indent/unindent operations

In case the request is sent to indent or unindent multiple tasks, the ID value in the request line is set to 0, each task ID with other parameters should be listed in the opbatch array of task objects.

In other words, to move multiple tasks, a json object in the request body should contain the opbatch array of tasks objects with the operations data.

Example:

{
"opbatch": [
{
"id": 1,
"parent": 3,
"targetId": 3,
"operation": "indent"
},
{
"id": 53,
"parent": 3,
"targetId": 3,
"operation": "indent"
}
]
}

operation === "project"

To move one task to another project:

  • Send the task ID as a query parameter in the request line
    OR
    Set this query parameter to 0 and add the task ID as the value of the batch property in the request body
  • In the request body:
    • Set the operation property value to project
    • Add the value of the project property which is the ID of a project where a task is moved
    • Add the task ID as the value of the batch property if the ID is set to 0 in the request line

Example:

    {
"project": 2,
"operation": "project",
"batch": [3]
}

If multiple tasks are moved to another project, the ID value in the request line is set to 0, and all tasks IDs are specified in the batch array.
If you move a task with child items, only the ID of its parent is specified in the batch array.
The batch property can contain any number of tasks IDs.

Example:

  {
"project": 2,
"operation": "project",
"batch": [3, 5, 8, 9]
}

Response

The HTTP status code shows whether the request succeeds (response.status == 200) or fails (response.status == 500).

In case of the success status, an empty json object is returned.


Related articles: