get_statistics

To get the aggregated statistics information, use the core/get_statistics method.

Copied!
svc=core/get_statistics&params={
  "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:
  • 1 — by days;
  • 2 — by weeks;
  • 4 — by months;
  • 8 — by quarters.
The default value is 1.
recursive Depending on the value:
  • 0 — use messages only from the desired resource;
  • 1 — use messages also from child resources.

Response

If the request is completed successfully, the response is returned in the following format:

Copied!
{
  "<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.

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