Получение данных по времени
Позволяет получить данные с разбивкой по времени (например, по дням, неделям, месяцам). Используйте данный тип запроса для построения графиков и отслеживания динамики.
Request
GET
https://api.appmetrica.yandex.net/stat/v1/data/bytime
Query parameters
|
Name |
Description |
|
params |
Type: BytimeParams Example: `` |
|
statGroupParams |
Type: StatGroupParams Example: `` |
BytimeParams
|
Name |
Description |
|
access_filter_id |
Type: integer |
|
accuracy |
Type: string Example: |
|
annotation_groups |
Type: string[] Example
|
|
callback |
Type: string Example: |
|
confidence_level |
Type: string Default: |
|
date_dimension |
Type: string Example: |
|
date1 |
Type: string Default: |
|
date2 |
Type: string Default: |
|
dimensions |
Type: string Example: |
|
direct_client_ids |
Type: integer[] Example
|
|
direct_client_logins |
Type: string[] Example
|
|
exclude_insignificant |
Type: boolean |
|
filters |
Type: string Example: |
|
group |
Type: string Группировка данных по времени:
Default: |
|
ids |
Type: integer[] Example
|
|
include_annotations |
Type: string Default: |
|
include_meta |
Type: boolean |
|
include_undefined |
Type: boolean |
|
keys_sort |
Type: string Example: |
|
lang |
Type: string Example: |
|
max_deviation |
Type: string Default: |
|
metrics |
Type: string Example: |
|
preset |
Type: string Example: |
|
pretty |
Type: string Default: |
|
proposed_accuracy |
Type: boolean |
|
reference_row_id |
Type: string[] Example
|
|
request_domain |
Type: string Example: |
|
require_metric_values |
Type: string Default: |
|
row_ids |
Type: string[][] Example
|
|
timezone |
Type: string Example: |
|
top_keys |
Type: string Default: |
|
with_confidence |
Type: boolean |
Example
{
"ids": [
0
],
"direct_client_ids": [
0
],
"direct_client_logins": [
"example"
],
"date1": "6daysAgo",
"date2": "today",
"timezone": "example",
"preset": "example",
"metrics": "example",
"dimensions": "example",
"reference_row_id": [
"example"
],
"filters": "example",
"accuracy": "example",
"proposed_accuracy": true,
"include_undefined": true,
"include_meta": true,
"with_confidence": true,
"exclude_insignificant": true,
"confidence_level": "0.95",
"max_deviation": "0.1",
"pretty": "false",
"lang": "example",
"request_domain": "example",
"require_metric_values": "false",
"access_filter_id": 0,
"group": "week",
"callback": "example",
"date_dimension": "example",
"row_ids": [
[
"example"
]
],
"top_keys": "7",
"keys_sort": "example",
"include_annotations": "false",
"annotation_groups": [
"example"
]
}
StatGroupParams
|
Name |
Description |
|
label_id |
Type: integer Min value: |
|
org_id |
Type: integer Min value: |
Example
{
"org_id": 1,
"label_id": 1
}
Responses
200 OK
OK
Body
application/json
{
"query": {
"timezone": "example",
"preset": "example",
"dimensions": [
"example"
],
"metrics": [
"example"
],
"sort": [
"example"
],
"date1": "example",
"date2": "example",
"filters": "example"
},
"data": [
{
"dimensions": [
{}
],
"metrics": [
[
0.5
]
]
}
],
"total_rows": 0,
"total_rows_rounded": true,
"sampled": true,
"contains_sensitive_data": true,
"sample_share": 0.5,
"sample_size": 0,
"sample_space": 0,
"data_lag": 0,
"totals": [
[
0.5
]
],
"annotations": [
[
{
"id": 0,
"date": "2025-01-01",
"time": "12:00:00",
"title": "example",
"message": "example",
"group": "example"
}
]
]
}
|
Name |
Description |
|
annotations |
Type: ConstructorReportChartAnnotation[][] Примечания. Example
|
|
contains_sensitive_data |
Type: boolean Признак возможного отсутствия конфиденциальных данных в ответе. К ним относятся данные, которые рассчитываются алгоритмами Яндекса, например, социально-демографические (пол, возраст и др.), адреса страниц входа, поисковые фразы, информация о роботах. При значении |
|
data |
Type: DynamicRow[] Example
|
|
data_lag |
Type: integer Задержка в обновлении данных, в секундах. |
|
query |
Type: DynamicQueryExternal Исходный запрос. Содержит параметры запроса, включая развернутые параметры из шаблона и параметры для схемы параметризации атрибутов. Example
|
|
sample_share |
Type: number Доля данных, по которым осуществлялся расчет. Доступно значение в пределах от 0 до 1. |
|
sample_size |
Type: integer Количество строк в выборке данных. |
|
sample_space |
Type: integer Количество строк данных. |
|
sampled |
Type: boolean Признак семплирования. Показывает, был ли применен семплинг. Возможные значения: |
|
total_rows |
Type: integer Общее количество строк в ответе по всему множеству данных (с учетом фильтра). |
|
total_rows_rounded |
Type: boolean Признак того, что общее количество строк было округлено. |
|
totals |
Type: number[][] Общие результаты для метрик по всему множеству данных (с учетом фильтра). Example
|
DynamicQueryExternal
Исходный запрос. Содержит параметры запроса, включая развернутые параметры из шаблона и параметры для схемы параметризации атрибутов.
|
Name |
Description |
|
date1 |
Type: string Дата начала периода выборки в формате YYYY-MM-DD. Example: |
|
date2 |
Type: string Дата окончания периода выборки в формате YYYY-MM-DD. Example: |
|
dimensions |
Type: string[] Example
|
|
filters |
Type: string Фильтр сегментации. Example: |
|
metrics |
Type: string[] Example
|
|
preset |
Type: string Пресет отчета. Example: |
|
sort |
Type: string[] Example
|
|
timezone |
Type: string Часовой пояс периода выборки в формате ±hh:mm. Example: |
Example
{
"timezone": "example",
"preset": "example",
"dimensions": [
"example"
],
"metrics": [
"example"
],
"sort": [
"example"
],
"date1": "example",
"date2": "example",
"filters": "example"
}
DynamicRow
Строки ответа. Представляет собой массив, каждый элемент которого — одна строка результата.
|
Name |
Description |
||
|
dimensions |
Type: object[]
Массив значений группировок для данной строки. Каждое из значений группировки представляет собой объект. В нем обязательно присутствует поле Example
|
||
|
metrics |
Type: number[][] Массив массивов значений метрик для данной строки. Внешний массив перечисляет метрики, внутренние массивы — значения конкретной метрики для каждой временной группы. Example
|
Example
{
"dimensions": [
{}
],
"metrics": [
[
0.5
]
]
}
ConstructorReportChartAnnotation
|
Name |
Description |
|
date |
Type: string<date> Дата. Example: |
|
group |
Type: string Группа:
Example: |
|
id |
Type: integer Идентификатор примечания. |
|
message |
Type: string Описание. Example: |
|
time |
Type: string<time> Время. Example: |
|
title |
Type: string Заголовок. Example: |
Example
{
"id": 0,
"date": "2025-01-01",
"time": "12:00:00",
"title": "example",
"message": "example",
"group": "example"
}