Table of Contents

Execute report

To execute a report, use the command report/exec_report:

svc=report/exec_report&params={"reportResourceId":<long>,
			       "reportTemplateId":<long>,
			       "reportObjectId":<long>,
			       "reportObjectSecId":<long>,
			       "interval":{
			       		"from":<uint>,
			       		"to":<uint>,
			       		"flags":<uint>
			       },
			       "tzOffset":<uint>,
			       "lang":<text>}

:!: Attention! There can be only one report in a session at the same time. Therefore if a session already has some report results, they must be cleared before executing a new report - with the command report/cleanup_result.

:!: You can find an example of this request in the sample Reports.

Parameters

Name Description
reportResourceId resource ID
reportTemplateId template ID
reportObjectId item ID
reportObjectSecId subitem ID (like driver, trailer or their groups), 0 - if the item has no subitems
interval report interval settings
from interval beginning, UNIX-time
to interval end, UNIX-time
flags interval flags
tzOffset timezone (see Time zones)
lang language (two-lettered code)

Interval flags:

Flag Description
0x00 specified interval
0x01 starts 'From' until today
0x02 for previous n days
0x04 for previous n weeks
0x08 for previous n month
0x10 for previous n years
0x20 including current
0x40 for previous n hours

Response

{
	"reportResult":{		/* report execution result */
		"msgsRendered":<int>,		/* messages loaded: 0 - no, 1 - yes */
		"stats":[			/* array of statistics parameters */
			[<text>,<text>]			/* [parameter name, value] */
		],
		"tables":[			/* array of tables */
			{
				"nm":<text>,		/* table type */
				"text":<text>,		/* name */
				"f":<uint>,		/* table flags (see below) */
				"r":<uint>,		/* quantity of lines */
				"c":<uint>,		/* columns count */
				"h":[<text>],		/* array of table headers */
				"t":[<text>]		/* total */
			}
		],
		"attachments":[			/* attachments array (charts, photos) */
			{
				"n":<text>,		/* name */
				"t":<text>		/* type: chart, photo */
			}
		]
	},
	"reportLayer":{			/* graphic layer */
		"name":<text>,			/* layer name */
		"bounds":[
			<double>,			/* minimal latitude */
			<double>,			/* minimal longitude */
			<double>,			/* maximal latitude */
			<double>			/* maximal longitude */
		],
		"units": [{		/* units */
			"id": <long>,		/* unit ID */
			"msgs":{		/* messages */
				"count":<uint>,		/* messages count */
				"first":{		/* first message from interval */
					"time":<uint>,		/* time */
					"lat":<double>,		/* latitude */
					"lon":<double>		/* longitude */
				},
				"last":{		/* last message of interval */
					"time":<uint>,		/* time */
					"lat":<double>,		/* latitude */
					"lon":<double>		/* longitude */
				}
			},
			"mileage":<double>,	/* mileage */
			"max_speed":<double>	/* maximal speed */
		}]
	},
	"layerCount":<uint>	/* quantity of layers to be merged in report layer */
}

To get all available types of tables, make the request report/get_report_tables.

Table flags:

Flag Description
0x1 Group by: days
0x2 Time limitation
0x4 Group by: weeks
0x8 Group by: months
0x10 Total
0x20 Charts: split sensors
0x100 Detalization: partial
0x200 Charts: count from zero
0x800 Detalization: full
0x1000 Row numbering