Get a report
To get the report, make a request:
https://adfox.yandex.com/api/report/result?taskId=<taskId>
Request parameters
| Parameter | Description | 
| 
 | The ID of the task 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 | 
| 
 | Report readiness at the time of request: 
 | 
| 
 | Data field ID. The order of field IDs in the  | 
| 
 | A description of the data field contents. | 
| 
 | Report data. | 
| 
 | The total value of the metric for the entire period. Filled out only for some of the fields. | 
| 
 | 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 row of response.table) {
    var value = row[impressionsTotalColumnNumber]
}