To execute a report, use the command report/exec_report:
svc=report/exec_report¶ms={"reportResourceId":<long>, "reportTemplateId":<long>, "reportObjectId":<long>, "reportObjectSecId":<long>, "reportObjectIdList":[<uint>, ...]}, "interval":{ "from":<uint>, "to":<uint>, "flags":<uint> }, "reportTemplate":<object>}
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. Also current request can't be executed simultaneously with following requests:
You can find an example of this request in the sample Reports.
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 |
reportObjectIdList | extra items ID array (for unit groups report) |
interval | report interval settings |
from | interval beginning, UNIX-time |
to | interval end, UNIX-time |
flags | interval flags |
reportTemplate | JSON of report template, which you can get from get_report_data request (optional parameter, used only if reportTemplateId equals 0) |
reportResourceId is required parameter, report will be executed as creator of this resource if reportTemplateId equals 0.
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 |
0x40 | for previous n minutes |
{ "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 */ { "name":<text>, /* table type */ "label":<text>, /* name */ "grouping": { "type":<text> /* grouping type */ }, "flags":<uint>, /* table flags (see below) */ "rows":<uint>, /* quantity of lines */ "level":<uint>, /* max level in table */ "columns":<uint>, /* columns count */ "header":[<text> ], /* array of table headers */ "total":[ /* total */ <text> /* array of cells */ ], "header_type" [<text>], /* Array of table headers types */ "totalRaw" [ /* Array of values for the string "Total" */ { "v":<double>, /* Original cell value */ "vt":<double>, /* Value type */ } ... ] } ], "attachments":[ /* attachments array (charts, photos) */ { /* for charts */ "name":<text>, /* name */ "type":<text>, /* type: chart, photo */ "datasets":[<text>] /* array with names of chart's curved lines */ "axis_x": <text>, /* Name for 'X' axis */ "flags": <uint>, /* Axis format, description below*/ "p":<text>, /* Chart settings */ }, { /* for photo and video */ "name":<text>, /* name and following parameters separated by ";" */ "ftm":<text>, /* formatted date */ "uid":<text>, /* unit ID */ "tm":<text>, /* UNIX time */ "idx":<text>, /* index of the same-type attachments registered simultaneously */ "lat":<text>, /* latitude */ "lon":<text>, /* longitude */ "type":<text> /* attachment type */ } ] }, "reportLayer":{ /* graphic layer */ "name":<text>, /* layer name */ "bounds":[ <double>, /* minimal latitude */ <double>, /* minimal longitude */ <double>, /* maximal latitude */ <double> /* maximal longitude */ ] }, "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 |
0x200000 | Group by: trips |
0x400000 | Group by: violation type |
Chart flags:
Flag | Additional flag | Description |
---|---|---|
0x4 | Correct maximum for 'Y' axis | |
0x10 | The format specified in the template settings | |
0x2 | Additional for 0x10 (Set format to “H:M:S”) | |
0x4 | Additional for 0x10 (Set format to “Y-m-E”) | |
0x80 | Generic type | |
0x100 | 24 hour format | |
0x20 | 24 hour format (additional for 0x100) | |
0x2 | 12 hour format (additional for 0x20) | |
0x40 | Display days of the week (additional for 0x100) |