Use the createReportDownload mutation to create a download and start the generation process.
As an input to define which report you want to generate a download from you can pass either reportId
or fields that describe the report: crawlId, reportTemplateCode, reportTypeCode, and optionally a segmentId.
For a list of available report template codes please refer to the Report templates section of this documentation.
By default generated file will have all default report metrics. To select only a specific set of metrics pass an array
of selected metric codes in the selectedMetrics property.
To get the filtered set of report rows use the filter property which can take any JSONObject
and works for all datasources, but is only validated after mutation is submitted. There are also strongly typed
filter properties for each of the datasources that you can use instead of a generic filter. Explore
CreateReportDownloadInput to see all available fields.
To know which datasource filter to use, you can get datasource code from a report or report template query.
For help with building filter queries go to filtering overview page.
A crawl can hold only one report download for each combination of report, report type, segment, filter, selected metrics, unwound metrics and output type. fileName is not part of it. Creating a report download that matches an existing one fails with the error code REPORT_DOWNLOAD_ALREADY_EXISTS, and the error's extensions.reportDownloadId holds the existing report download's ID, so you can fetch it as in Step 3 instead of creating another. The ID is left out when the existing download belongs to a task.
A standard metric's column is headed by its metric code, such as url or found_at_url.
A custom extraction's column is headed by its label.
A custom metric's column is headed by its key. An array metric's automatic __count column is headed <key>Count, and the members of an unwound object-array metric are headed <key>.<member>. A metric whose key was generated rather than derived from its name, such as metric_3f9c…, is headed by its display title instead, with its count column headed <title> count.
Two columns in one file never share a heading. When a custom extraction's or custom metric's heading is already used by another column in the file, its code is appended in brackets, for example url (_119_url_ab12cd34ef). If that is taken too, a number follows the code. Standard metric columns always keep their code. A column you leave out with selectedMetrics takes no heading, so it never causes a suffix.
The response contains authenticated links to download the requested files. Each query returns fresh links, and a link can expire within a few hours, so download the files soon after requesting them. If a link has expired, query fileURL again for a new one.
Download links are served from https://downloads.lumar.io and need no login or API token. If your network only allows approved domains, allow downloads.lumar.io over HTTPS. Some older report downloads still link to Amazon S3 (*.s3.amazonaws.com), so keep any existing allowance for it.