Skip to content

AdvReport

Generates one subscription of an advanced report now and returns its file, in the subscription’s format. Another system uses it to fetch the report when it needs it, instead of receiving it by email, FTP or web API. For a query report, use QueryReport.

Only a subscription with Enable API Access on can be fetched. The owner of the report or a system administrator turns it on in the subscription’s options when they create or modify the subscription. See also Fetch a report through the API.

How to send the key and read the response: API keys, Responses.

GET /api/public/AdvReport?APIKey=your-api-key&SubID=your-subscription-id

Send the key in the APIKey query string parameter. The key must be allowed to get advanced reports (advrep.getreport); TrakIT Support sets this up. URL-encode both values. The key is part of the address, so keep these URLs out of logs you share.

Parameter Required Meaning
APIKey Yes The API key.
SubID Yes The subscription’s ID. To get it, open the subscription with Modify and select Copy ID next to Enable API Access.

Both must be in the query string: without one, TrakIT answers HTTP 404.

The request cannot change the report: the subscription’s own filters, the report’s filters, and the subscription’s format and options apply.

Rule Info when it fails
APIKey is not empty. API Key is missing
The key is active and allowed to get advanced reports. Key is disabled, not recognized or permission denied
SubID is not empty. SubID is missing
SubID is a subscription ID. Invalid SubID
The subscription exists. Unable to load
The subscription has Enable API Access on. Report not enabled for API access
The advanced report is active: see Modify the report. Report is not active
The report or the subscription has at least one active filter. No filters found

The report must then be generated. If it can’t be, for example because no work order or job matches the filters and Generate Empty Report is off, or because the same subscription is being generated at that moment, the response is the JSON envelope instead of the file, with Code other than 1.

A successful response is the report file, generated the same way as the subscription’s Preview. A refusal is JSON, so tell them apart by the Content-Type:

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="Weekly status_2610201430.xlsx"

The file name is the subscription’s title, then the date and time in UTC as yyMMddHHmm, then the extension of the subscription’s Report Type:

Report Type File
Form Template PDF .pdf
Comma Separated Values (CSV) .csv
HTML File (HTM) .htm
Excel Spreadsheet (XLSX) .xlsx
Plain Text (TXT) .txt
JSON .json

The file is never zipped, even with Zip Report (.zip format) on, and it is not kept on the report’s History tab.

  • Each call that gets as far as generating the report is listed in the report queue, with API Call as its delivery.
  • The call returns once the report is generated, which takes as long as a preview of the subscription. Allow for it in your client’s timeout.
  • A subscription can’t be generated twice at the same time. If your calls may overlap with each other, with a preview or with a scheduled send of the same subscription, wait a moment and call again when you don’t get the file.