E
E
Eric Packer2019-06-12 19:27:34
Yandex.Metrica
Eric Packer, 2019-06-12 19:27:34

How to access Yandex.Metrica data via the API?

Hello. I'm trying to display data from the metric on the site via json.
I created an application, created an oauth_token, but when I try to get data, I get a 403 error (no access).
For example, I use the query:

https://api-metrika.yandex.ru/stat/v1/data?metrics=ym:s:visits,ym:s:pageviews&dimensions=ym:s:referer,ym:s:startURLDomain&date1=2015-01-01&date2=yesterday&limit=10000&offset=1&ids=<мойidсчетчики>&oauth_token=<мойoauth_token>

And I get:
{"errors":[{"error_type":"access_denied","message":"Access is denied"}],"code":403,"message":"Access is denied"}
If I make the Metrics counter public and open access to everyone, then everything works, and the data is returned correctly.
Is it possible, without making the counter public, to ensure that the data is given?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2020-06-04
@lukyoung

write in headingsAuthorization: OAuth <oauth_token>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question