get_statistics
To get the aggregated statistics information, use the core/get_statistics method.
svc=core/get_statistics¶ms={
"resourceId": <long>,
"timeFrom": <uint>,
"timeTo": <uint>,
"type": "<text>",
"interval_type": <uint>,
"recursive": <uint>
}
Parameters
| Parameter | Description |
|---|---|
| resourceId | Resource ID. |
| timeFrom | Time from in the Unix time format. |
| timeTo | Time to in the Unix time format. |
| type | One of the following: items, logins, hw, sms. |
| interval_type | The style of grouping the results:
|
| recursive | Depending on the value:
|
Response
If the request is completed successfully, the response is returned in the following format:
{
"<timestamp>": {
"<resource_id>": {
"<parameter_name>": <int>, /* Statistics parameter name-value pairs. */
...
}
},
...,
"users": {
"<user_id>": "<text>", /* User ID-name pairs. */
...
}
}
The list of available statistics parameters:
sms_count;sms_nf_count;sms_count_<user_id>;sms_job_count;sms_order_count;sms_manual_count;sms_auth_count;sms_cmd_<sms_type>_count;logins_count_<user_id>;logins_duration_<user_id>;<unit_type_name>_deleted;<unit_type_name>_created;<item_type_name>_created;<resource_type_name>_created;<type_name>_created;hw_<hw_type_id>;<user_type_name>_created;avl_driver_created;avl_driver_deleted;avl_job_created;avl_job_deleted;avl_notification_created;avl_notification_deleted;avl_tag_created;avl_tag_deleted;avl_trailer_created;avl_trailer_deleted;avl_geozone_created;avl_geozone_deleted;avl_unit_sensor_created;avl_unit_sensor_deleted;avl_unit_activated;avl_unit_deactivated;avl_unit_total.
The avl_unit_total parameter is returned in response to the request with “type”: “items”. It shows the total number of units related to the specified account and subordinate accounts.
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | Wrong input parameters. |
| 7 | The resource isn’t found, there is no View object and its basic properties access right to the resource, or the type value is unexpected. |