---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.1
alternate:
  - https://yandex.ru/dev/adfox/doc/en/statistics/methods/get-report.md
  - https://yandex.ru/dev/adfox/doc/ru/statistics/methods/get-report.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/dev/adfox/doc/en/llms.txt

# Get a report

To get the report, make a request:

```httpget
https://adfox.yandex.com/api/report/result?taskId=<taskId>
```

#### Request parameters

#|
|| **Parameter** | **Description** ||
|| 
`taskId` | [The ID of the task](https://yandex.ru/dev/adfox/doc/en/statistics/methods/report-request.md) to generate a request. ||
|#


#### Response format

The request returns the report. The report is generated in JSON format:

```
{
  "result": {
      "taskId": ()
      "state": ()
      "fields": [
          <fieldId>,
          ...
      ],
      "fieldsInfo": {
          <filedId>: <fieldInfo>
      },
      "table": [
          [
              <dataRowField>,
              ...
          ],
          ...
      ],
      "totals": {
          <fieldId>: <totalValue>,
          ...
      },
      "eventHorizon": <eventHorizon> 
  },
  "error": <errorCode>
}
```

#|
|| **Parameter** | **Description** ||
|| 
`state` | Report readiness at the time of request:
- PENDING: Waiting for generation to begin.
- STARTED: Generating the report.
- SUCCESS: The report is ready. ||
|| 
`fieldId` | Data field ID. The order of field IDs in the `fields` array matches the order in the `table` data array. ||
|| 
`fieldInfo` | A description of the data field contents. ||
|| 
`dataRowField` | Report data. ||
|| 
`totalValue` | The total value of the indicator for the entire period. Filled out only for some of the fields. ||
|| 
`eventHorizon` | The day of the reporting period before which the report data is guaranteed to be complete, in the `YYYY-MM-DD hh:ii:ss` format. ||
|#


#### Order of values in the `table` arrays

The response includes a field called `fields`, which indicates the order of values in the `table` field arrays.

For example, a column named **campaign_id** appears third in `fields`. In this case, it will also be the third element in each array within `table`.

Pseudocode:

```
// API response
var response = {
    ...
    fields: ["campaign_name", "campaign_id", "impressions_total"]
    table: [
        ['campaign 1', 101, 1000],
        ['campaign 2', 102, 1000],
        ['campaign 3', 103, 1000]
    ]
    ...
}

}// To get the value of the "impressions_total" column, we need to find out its number
var impressionsTotalColumnNumber = array_search('impressions_total', response.fields)

// Having gotten the column number, we can now get its value
for (
    var value = row[impressionsTotalColumnNumber]
}
```

