S
S
sorry_i_noob2018-12-03 23:54:39
PHP
sorry_i_noob, 2018-12-03 23:54:39

Why is an error displayed when trying to get clicks and cost in Yandex Direct API? And if you leave the same code, but receive campaigns, then everything is fine?

Hello!
I am learning to work with Yandex Direct API. I copied the example code from their website:
https://tech.yandex.ru/direct/doc/examples-v5/php5... I inserted
my token, removed the login (I have NOT an agency), changed $url to a sandbox. I tried to run - everything is fine.
I replaced $url with this one:
https://api-sandbox.direct.yandex.com/json/v5/reports
This is for getting clicks and cost, I found it here:
https://tech.yandex.ru/ direct/doc/reports/example-...
I get an error:

Warning: file_get_contents( https://api-sandbox.direct.yandex.com/json/v5/reports): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in D:\1Develop\domains\direct\index.php on line 44

Yes, I know that clicks and costs need other parameters ($params variable).
I removed everything in $params except 'method' => 'get'. For campaigns, I began to receive a message:
API Error 8000: Bad Request - params cannot be null (RequestId: 402619380448874005)

But for clicks and cost the same mistake. So the problem is with the link? How to solve this error?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question