Пример: данные Яндекс Метрики

Пример демонстрирует получение данных Яндекс Метрики по выбранным целям и заданной модели атрибуции.

Запрос

curl \
-H 'Authorization: Bearer 0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f' \
-H 'Accept-Language: en' \
-H 'Client-Login: agrom' \
-H 'skipReportHeader: true' \
-H 'returnMoneyInMicros: false' \
-d '{
  "params": {
    "SelectionCriteria": { },
    "Goals": [ "20002", "20003" ],
    "AttributionModels": [ "LSC" ],
    "FieldNames": [ "Date", "Clicks", "Impressions", "Conversions", "CostPerConversion", "GoalsRoi", "Revenue", "ConversionRate"], 
    "OrderBy": [{
      "Field": "Date"
    }],
    "ReportName": "Conversions",
    "ReportType": "ACCOUNT_PERFORMANCE_REPORT",
    "DateRangeType": "LAST_5_DAYS",
    "Format": "TSV",
    "IncludeVAT": "YES",
    "IncludeDiscount": "YES"
  }
}' \
https://api.direct.yandex.com/json/v5/reports
curl \
-H 'Authorization: Bearer 0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f' \
-H 'Accept-Language: en' \
-H 'Client-Login: agrom' \
-H 'skipReportHeader: true' \
-H 'returnMoneyInMicros: false' \
-d '<?xml version="1.0" encoding="UTF-8"?>
  <ReportDefinition xmlns="http://api.direct.yandex.com/v5/reports">
    <SelectionCriteria/>
    <Goals>20002</Goals>
    <Goals>20003</Goals>
    <AttributionModels>LSC</AttributionModels>
    <FieldNames>Date</FieldNames>
    <FieldNames>Clicks</FieldNames>
    <FieldNames>Impressions</FieldNames>
    <FieldNames>Conversions</FieldNames>
    <FieldNames>CostPerConversion</FieldNames>
    <FieldNames>GoalsRoi</FieldNames>
    <FieldNames>Revenue</FieldNames>
    <FieldNames>ConversionRate</FieldNames>
    <OrderBy>
      <Field>Date</Field>
    </OrderBy>
    <ReportName>Conversions</ReportName>
    <ReportType>ACCOUNT_PERFORMANCE_REPORT</ReportType>
    <DateRangeType>LAST_5_DAYS</DateRangeType>
    <Format>TSV</Format>
    <IncludeVAT>YES</IncludeVAT>
    <IncludeDiscount>YES</IncludeDiscount>
  </ReportDefinition>' \
https://api.direct.yandex.com/v5/reports

Ответ

Date	Clicks	Impressions	Conversions_20002_LSC	Conversions_20003_LSC	CostPerConversion_20002_LSC	CostPerConversion_20003_LSC	GoalsRoi_20002_LSC	GoalsRoi_20003_LSC	Revenue_20002_LSC	Revenue_20003_LSC	ConversionRate_20002_LSC	ConversionRate_20003_LSC
2018-04-15	22	3282	2	2	12.54	17.06	3.39	5.57	110	224	9.09	9.09
2018-04-16	49	7493	6	1	3.48	20.43	25.38	4.87	550	120	12.24	2.04
2018-04-17	44	5773	5	--	28.05	--	2.92	--	550	--	11.36	--
2018-04-18	51	2268	5	1	13.42	1.61	3.92	23.77	330	40	9.8	1.96
2018-04-19	33	3511	4	1	9.83	4.07	7.39	48.17	330	200	12.12	3.03
Total rows: 5