Answer the question
In order to leave comments, you need to log in
How to get the Yandex Direct API report?
I take an example from the page https://tech.yandex.ru/direct/doc/reports/example-... I
substitute my sandbox token, campaign ID and sandbox URL
curl \
-H 'Authorization: Bearer AQAAAAAXZmPmAAQQaVHiaEcDHUBitQkG23T2oSk' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<ReportDefinition xmlns="http://api.direct.yandex.com/v5/reports">
<SelectionCriteria>
<Filter>
<Field>CampaignId</Field>
<Operator>EQUALS</Operator>
<Values> 193407 </Values>
</Filter>
</SelectionCriteria>
<FieldNames>Date</FieldNames>
<FieldNames>Clicks</FieldNames>
<FieldNames>Cost</FieldNames>
<FieldNames>AdNetworkType</FieldNames>
<OrderBy>
<Field>Date</Field>
</OrderBy>
<ReportName>Campaign #10002, August</ReportName>
<ReportType>CUSTOM_REPORT</ReportType>
<DateRangeType>THIS_MONTH</DateRangeType>
<Format>TSV</Format>
<IncludeVAT>NO</IncludeVAT>
<IncludeDiscount>NO</IncludeDiscount>
</ReportDefinition>' \
https://api-sandbox.direct.yandex.com/json/v5/reports
{"error":{"error_detail":"Not able to process JSON","request_id":"6455035304750394714","error_string":"Invalid request","error_code":"8000"}}
Answer the question
In order to leave comments, you need to log in
The method you are trying to call takes json as input, and the request body is in xml.
https://api-sandbox.direct.yandex.com/json/v5/reports - pay attention to /json/
You can use another method to work with xml https://api-sandbox.direct.yandex.com/v5/ reports
Or pass the request body in json format
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question