The previous asynchronous report-generation workflow, based on report definitions and task polling
This asynchronous report-task workflow is superseded by the Reports API. It still works for existing integrations but will not receive new features — new integrations should use the Reports Lens or the Reports API instead.
Generate campaign performance reports and access analytics data through the report domain. The ADP API uses an asynchronous report generation workflow based on pre-defined report definitions.
Overview
Thanks to a unified report architecture, you can get data about emissions, events, or users through a single request. Report definitions are pre-arranged templates — all you need is a report definition name and some parameters to generate a custom report.
The Reporting API provides:
- Report Definitions - Pre-defined report templates that standardize and unify the reporting area
- Report Generation - Create asynchronous report tasks
- Task Monitoring - Check report generation progress
- Data Download - Download completed reports
Asynchronous Workflow
Reports are generated asynchronously because they may process large amounts of data. You receive a
task_idto track progress.
sequenceDiagram
participant Client
participant API
participant ReportEngine
Client->>API: 1. generate_report mutation
API->>ReportEngine: Create task
API-->>Client: Return task_id
ReportEngine->>ReportEngine: Process data
Client->>API: 2. report_task query (check status)
API-->>Client: Status: PROCESSING
Client->>API: 3. report_task query (check again)
API-->>Client: Status: DONE + task_download_url
Client->>API: 4. Download report data
API-->>Client: Report data
Workflow Steps
- Generate - Submit
generate_reportmutation with a report definition and parameters → receivetask_id - Monitor - Poll
report_taskquery withtask_id→ check status - Download - When status =
DONE, usetask_download_urlto download report data
Quick Start
1. List Available Report Definitions
Report definitions are pre-defined templates. To list them, use the following query. Inspect the report_definition_body attribute of each definition to see available parameters — they are mostly self-descriptive.
{
report {
report_defs {
edges {
report_definition_name
report_definition_description
report_definition_body
}
}
}
}Response:
{
"data": {
"report": {
"report_defs": {
"edges": [
{
"report_definition_name": "op_mailings_historical",
"report_definition_description": "Historical for Mailings",
"report_definition_body": { "..." : "..." }
}
]
}
}
}
}2. Generate a Report Task
Once you have selected a report definition and specified its parameters, submit a report generation request. The response returns a task_id — a unique identifier used to check the task status and download the report.
Example: Collect data for a line item (ID: 980071) emitted between 2022-01-01 and 2022-02-01. We want ad server impressions (filled_emission) and click events (adclick), split by day. We use the historical report definition.
mutation generateReport(
$report_definition_name: ID!
$report_name: String!
$attributes: ReportTaskAttrInput!
$task_external_id: String
$task_external_type: String
) {
report {
generate_report(
task: {
report_definition_name: $report_definition_name
report_name: $report_name
attributes: $attributes
task_external_type: $task_external_type
task_external_id: $task_external_id
}
) {
task_id
}
}
}Variables:
{
"report_definition_name": "historical",
"report_name": "Gotom report demo",
"attributes": {
"date_range": {
"kind": "dynamic",
"date_from": "2022-01-01 00:00:00",
"date_to": "2022-02-01 23:59:59"
},
"filters": [
{
"dimension": "ID_1",
"type": "in",
"values": [
{
"value": "980071"
}
]
}
],
"split": [
"ID_1"
],
"metric": [
"adclick",
"filled_emission"
],
"granularity": "day"
}
}Response:
{
"data": {
"report": {
"generate_report": {
"task_id": "2879"
}
}
}
}3. Get Report Task Status and Data
After the task is created, poll for its status and — when completed — retrieve the download URL.
query getReportTaskWithResults($task_id: Int!) {
report {
report_task(task_id: $task_id) {
task_id
task_token
task_name
task_status
task_progress
task_start_time
task_end_time
task_duration
task_download_url
}
}
}Variables:
{
"task_id": 2879
}Response (completed):
{
"data": {
"report": {
"report_task": {
"task_id": "2879",
"task_token": "8f583f4b-a9df-4007-bc75-6890b5a7fd03",
"task_name": "TEST Mailing report",
"task_status": "DONE",
"task_progress": 100,
"task_start_time": "2018-03-02T13:05:45.000Z",
"task_end_time": "2018-03-02T13:05:51.000Z",
"task_download_url": "https://adp-reports.dreamlab.pl/8f583f4b-a9df-4007-bc75-6890b5a7fd03/"
}
}
}
}4. Download Report
Use the task_download_url from the completed task response. Append ?format=raw to the URL to fetch all report data in raw format.
Examples:
# Download report in default format
curl -X GET \
-H "x-internal-auth-login: YOUR_CLIENT_LOGIN" \
-H "x-internal-auth-token: YOUR_CLIENT_TOKEN" \
"https://adp-reports.dreamlab.pl/8f583f4b-a9df-4007-bc75-6890b5a7fd03/"
# Download report in raw format
curl -X GET \
-H "x-internal-auth-login: YOUR_CLIENT_LOGIN" \
-H "x-internal-auth-token: YOUR_CLIENT_TOKEN" \
"https://adp-reports.dreamlab.pl/8f583f4b-a9df-4007-bc75-6890b5a7fd03/?format=raw"Task Statuses
| Status | Description | Next Action |
|---|---|---|
PENDING | Task created, waiting to start | Wait and poll |
PROCESSING | Report generation in progress | Wait and poll |
DONE | Report ready for download | Use task_download_url |
FAILED | Report generation failed | Check error details |
Report Attributes Reference
When creating a report task, the attributes object accepts the following parameters (availability depends on the report definition):
| Parameter | Description |
|---|---|
date_range | Time period for the report (kind, date_from, date_to) |
filters | Array of filter objects (dimension, type, values) |
split | Dimensions to split data by (see Report Dimensions) |
metric | Metrics to include (see Report Metrics) |
granularity | Time granularity: day, hour, etc. |
timezone | Optional IANA timezone (e.g. Europe/Warsaw) used to bucket and interval the report's data. Must be a valid IANA name — an unknown value is rejected. Omit to use your network's default timezone. |
Related
- Report Dimensions - Available dimensions for splitting report data
- Report Metrics - Available metrics for report data
