Resources and method calls

Resources

The Yandex Metrica API is built on REST principles.

Everything that can be managed via the API is represented by resources: statistics, the list of counters, the counter itself, counter goals and each specific goal, counter access, and so on.

So a resource is an integral part of the system that you can work with:

  • Read the contents and current status of the resource (GET).
  • Modify the contents and status and write it to the resource (PUT).
  • Delete the resource (DELETE).
  • Perform special actions, such as adding new elements to a list (POST).

Each resource has its own unique URL. All actions are executed by the corresponding HTTP methods at the resource URLs.

For example, to get information about a counter, you send a GET request to the counter URL. And to create a new counter, you send a POST request with the counter body to the URL of the “counter list” resource.

Method calls

Note

Requests to the Yandex Metrica API are transmitted over the HTTPS protocol.

Requests use the following format:

<method type> https://api-metrica.yandex.net/<API_section>/<version>/<method_name>.<result_format>?<parameters>

<method type>

GET, POST, PUT, or DELETE.

<API_section>

Name of the API section where the action takes place. Existing sections:

  • management (Management API and Logs API).
  • stat (Reporting API).
  • analytics (API compatible with the Google Analytics Core Reporting API).

<version>

Number of the current API version.

<method_name>

URL of the resource that the action applies to.

<result_format>

Optional part of the request. It sets the result format. By default, data is transmitted in JSON format.

<parameters>

Required and optional request parameters.

Learn more

Previous
Next