update_task

The unit/update_task request allows you to edit tasks.

Copied!
svc=unit/update_task&params={
	"itemId": <long>,
	"taskId": <text>,
	"props": {
		"key1": <long>,
		"key2": <text>,
		.....
	}
}

Request example:

Copied!
https://hst-api.wialon.com/wialon/ajax.html?sid=5e860dbe24e3d704ffb196d0733ec714&svc=unit/update_task&params={
"itemId": 1514,
"taskId": "6f6aeeebad9ebe64bda86924f8d379d8e6b06bd690c53da4aab526c5e221bdb266b52a50",
"props": {
"task_status": 2,
"task_priority": 3
}
}

Parameters

The following parameters are required:

Name

Description

itemIdThe ID of the unit.

taskId

The ID of the task (a string hash).

props

The object of properties to be updated (key-value pairs). Include only those properties that you want to update, because each update fully replaces the corresponding existing property. Below is the list of flags that you can include in this parameter to update the task properties.

Flags

Flag

Description

task_status

The status of the task. The acceptable values are:

  • 1 (New),
  • 2 (To do),
  • 3 (In progress),
  • 4 (Paused),
  • 5 (Rejected),
  • 6 (Done).

task_priority

The priority of the task. The acceptable values are: 

  • 1 (Low),
  • 2 (Medium),
  • 3 (High).

task_assignee

The ID of the user to whom the task is assigned. 

task_commentsThe comment on the task. The comment field must not be empty or exceed 500 characters.

The task_comment flag must be structured as follows:

Copied!
[
    {
        timestamp: 13243,
        assignee: 1564,
        comment: "Hello world"
    }, 
    {
        timestamp: 13244,
        assignee: 1564,
        comment: "Hello world 2"
    }
]

Response

If the request is completed successfully, an empty response is returned.

Copied!
{ }

Otherwise, an error code is returned. Example:

Copied!
{
    "error": 5
}

Error codes

Error codeDescription
4Invalid input parameters.
5

Request execution error. 

Failed to find the task with the specified ID. 

6Unknown error.
2008

Access denied. The following access rights are required:

  • View object and its basic properties right to the unit,
  • Act on behalf of this user right to the task assignee.

This error also occurs in case the provided user ID of the task assignee is not found.

Download PDF file
Download Word document

See also