get_statistics

The get_statistics function is used to receive the aggregated statistics information.

Copied!
svc=core/get_statistics&params={"resourceId":<long>, 
								"timeFrom":<uint>,
								"timeTo":<uint>,
								"type":"<text>",
								"interval_type":<uint>,
								"recursive":<uint>}

Parameters

NameDescription

resourceId

Resource ID.

timeFrom

Time from in the Unix time format.

timeToTime to in the Unix time format
typeOne of following: items, logins, hw, sms.
interval_type

The style of grouping the results:

  • by days;
  • by weeks;
  • by months;
  • by quarters.

The default value is 1.

recursive

Depending on the value:

  • use messages only from desired resource;
  •  use messages also from child resources.

Returned result

Copied!
{
	"<timestamp>":{ 
		"<resource_id>":{
			"<parameter_name>": <int>,	/* statistics parameter Name-Value pairs  */
			...
		}
	},
	...,
	"users": {
		"<user_id>": "<text>",	/* 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 parameter avl_unit_total 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.

Error codes

Possible error codes:

CodeDescription
7Failed to fetch the user with the desired ACL (ADF_ACL_ITEM_VIEW) or unexpected type value.
4Wrong input parameters.
Download PDF file
Download Word document

See also