getReport

Follow

Api/Reports/getReport generates report content, either in machine-readable XML/JSON or some graphical format.

Requirements

API user must have access to reports module, and to that specific report you're asking for.

How to use

You need report ID, supported parameters and other details, like object or person identifiers. Here's overview, how to get those prerequisites.

Syntax

Api/Reports/getReport (id, parameters, [stateId], [format])
  • id: report identification. You get available values from listReports
  • stateId: ID of customised report, if you want to use it (see listReports). Default, you can open report with default column set, but if you specify stateId, you get column set defined under that report.
    • You can define customised reports under SeeMe - settings - reports - report column settings - (individual report). You can create customised public and personal reports.
  • parameters: those are actually multiple parameters, what you have to compose manually. See overview and example, how to apply them.
  • format: specifies, in what form report is generated, in text or graphical form.
    • xml - default format. If parameter is empty, this or json is used.
    • csv - comma-separated text
    • xls - Excel format
    • html - as webpage
    • pdf - Adobe format

Response

if everything goes well, report is generated. Depending on format, it's either downloadable file or text.

When XML is used, there are two elements inside response:

  • data - contains <node/> elements, what represent report rows. Individual cells are column names taken from getReportConf, output part.
  • title - report title in language of API user

Example

This is how one report response may look like.

 

XML
<?xml version="1.0" encoding="utf-8" ?>
<nodes>
  <status>0</status>
  <response>
    <data>
      <node key="0">
        <date>2019-10-10</date>
        <time>08:35:29</time>
        <timestamp>2019-10-10 08:35:29</timestamp>
        <objectId>157423</objectId>
        <objectName>123ABC</objectName>
        <location>Raudtee 2a, Nõo alevik, Nõo vald, Tartumaa, EE</location>
        <fuelBefore>17</fuelBefore>
        <fuelAdded>51</fuelAdded>
        <fuelAfter>68</fuelAfter>
        <driverName>Markus Sucher</driverName>
      </node>
      <node key="1">
        <date>2019-10-18</date>
        <time>08:37:53</time>
        <timestamp>2019-10-18 08:37:53</timestamp>
        <objectId>157423</objectId>
        <objectName>123ABC</objectName>
        <location>Raudtee 2a, Nõo alevik, Nõo vald, Tartumaa, EE</location>
        <fuelBefore>17</fuelBefore>
        <fuelAdded>50</fuelAdded>
        <fuelAfter>67</fuelAfter>
        <driverName>Markus Sucher</driverName>
      </node>
    </data>
    <title>Fuel report 09.10.2019-21.10.2019</title>
  </response>
</nodes>
JSON
{
"status":0,
"response":{
  "data":[{
      "date":"2019-10-10",
      "time":"08:35:29",
      "timestamp":"2019-10-10 08:35:29",
      "objectId":"157423",
      "objectName":"123ABC",
      "location":"Raudtee 2a, Nõo alevik, Nõo vald, Tartumaa, EE",
      "fuelBefore":17,
      "fuelAdded":51,
      "fuelAfter":68,
      "driverName":"Markus Sucher"
    },{
      "date":"2019-10-18",
      "time":"08:37:53",
      "timestamp":"2019-10-18 08:37:53",
      "objectId":"157423",
      "objectName":"123ABC",
      "location":"Raudtee 2a, Nõo alevik, Nõo vald, Tartumaa, EE",
      "fuelBefore":17,
      "fuelAdded":50,
      "fuelAfter":67,
      "driverName":"Markus Sucher"
    }],
  "title":"Fuel report 09.10.2019-23.10.2019"
}
}

 

You can find more comprehensive example here.

 Troubleshooting

There may arise following problems:

  • error 7 "no permissions": API user does not have access to reports module. Please add it via roles to API user.
  • error 8 "no rights for this report": API user does not have access to this report, or id is erroneous. Please make sure that this ID is listed in listReports.
  • data is empty: try following suggestions.
    • please try to open same report manually. Does it contain any data?
    • Please check report parameters. Are they in correct format, and cover right period?
    • Does API user have access to those vehicles and users you try to ask data from?

If you really get stuck, please write to customer support.

Was this article helpful?
0 out of 0 found this helpful