get_task_messages

To load task messages for units, use the messages/get_task_messages method.

To get task messages, you need the View object and its basic properties and Request reports and messages access rights to the units. The Tasks service must be enabled and active for the account.

Endpoint

Copied!
svc=messages/get_task_messages&params={
	"itemIds": [<long>],
	"timeFrom":<uint>,
    "timeTo":<uint>,
    "loadCount":<uint>
}

Request example

Copied!
https://hst-api.wialon.com/wialon/ajax.html?sid=SESSION_IDENTIFIER&svc=messages/get_task_messages&params={       
        "itemIds":[1546, 1545],
        "timeFrom": 1724347800,
        "timeTo": 1724693399,
        "loadCount": 10000
}

Parameters

The following parameters are required:

Name Description
itemIds Array of unit IDs for which task messages are requested.
timeFrom The beginning of the time interval (Unix time, UTC).
timeTo The end of the time interval (Unix time, UTC). Must be greater than or equal to timeFrom.
loadCount Number of messages to return. The maximum number is 20000.

Response

If the request is completed successfully, the response contains the number of task messages and the array of messages. Each message contains the unit ID (item_id), the message time (t), the message flags (f, always 20480 for tasks), and the task parameters (p). Messages are sorted by time, from the oldest to the newest. If the number of found messages is greater than loadCount, only the newest messages are returned.

Copied!
{
    "count": 2,
    "messages": [
        {
            "item_id": 1546,
            "t": 1724420460,
            "f": 20480,
            "p": {
                "task_id": "b1978b93a308c5c3be0697223bf0c5002ee87de02ce7937b23a34830516c330466c8916c",
                "task_sub_type": "speed",
                "task_reg_type": 2,
                "task_account": 1063,
                "task_status": 6,
                "task_description": "VHS Glitch violated speed limitations.",
                "task_priority": 2,
                "task_assignee": 0,
                "task_evt_name": "Speeding",
                "task_tags": "{\"SPEED\":\"25 km/h\",\"POS_TIME\":\"10.07.2025 15:52:28\",\"UNIT\":\"VHS Glitch\"}",
                "task_comments": [
                    {
                        "id": 1,
                        "timestamp": 1724420600,
                        "assignee": 1039,
                        "last_edited_by": 0,
                        "last_edit_time": 0,
                        "comment": "The driver has been notified."
                    }
                ],
                "task_update_time": 1724420600,
                "task_address_x": 56.65078,
                "task_address_y": 53,
                "task_done_rejected": 1724420600,
                "task_params": {}
            }
        },
        {
            "item_id": 1545,
            "t": 1724506800,
            "f": 20480,
            "p": {
                "task_id": "c52f1f15dd9a2c5b3258102cde5ad75a24b76820b4cf0d2438c835d796a2fd5966c8916c",
                "task_sub_type": "fuel_filling",
                "task_reg_type": 1,
                "task_account": 1063,
                "task_status": 1,
                "task_description": "Refuel before the next trip.",
                "task_priority": 3,
                "task_assignee": 1039,
                "task_evt_name": "Fuel filling",
                "task_tags": "",
                "task_comments": [],
                "task_update_time": 1724506800,
                "task_address_x": 56.65078,
                "task_address_y": 53,
                "task_done_rejected": 0,
                "task_params": {
                    "filled": 40,
                    "cost": 60.5
                }
            }
        }
    ]
}

For the description of the task parameters and the values of task_reg_type, task_status, and task_priority, see Task. For the values of task_sub_type, see Event and task subtypes.

If the request is not completed, an error code is returned.

Error codes

Error code Description
4 Invalid input parameters (for example, timeFrom > timeTo, or missing required fields).
5 Request execution error.
7 Access denied. No required access rights to the units or the Tasks service is not enabled or active.
1004 The maximum number of messages (loadCount) is exceeded.

If you find a mistake in the text, please select it and press Ctrl+Enter.