Estimated audience of the complete plays
GET /api/v1/stats/audience
https://app.tanba-ooh.kz/api/v1/stats/audience
Анықтамалықтың техникалық мәтіні ағылшын тілінде жазылған.
Scope read:stats. Own organisation; the authority sees the city. For each period, structure and approval: the plays, the complete plays and an estimate of the people who noticed the screen. The estimate is not measured: it comes from a versioned model whose inputs are assumptions until counted figures replace them, and it is information only. The bill counts plays. Incomplete plays add nothing to the estimate. Days are Asia/Almaty days; a month uses the model that applies to it.
Аутентификация
Authorization тақырыбындағы API кілті немесе консоль сеансы.
Рұқсат: read:stats
Параметрлер
| Атауы | Орны | Түрі | Міндетті | Сипаттама | Мысал |
|---|---|---|---|---|---|
from | сұрау | string (date) | жоқ | First day (default 29 days back). | 2026-09-01 |
to | сұрау | string (date) | жоқ | Last day (default today). | 2026-09-30 |
grain | сұрау | string | жоқ | Length of one period: day or month. day, month | day |
structure | сұрау | string | жоқ | Code of one structure. | ALM-0012 |
approval | сұрау | string | жоқ | Number of one approval. | TNB-2026-000123 |
Жауаптар
200 The estimate for each period, structure and approval.
application/json
| Атауы | Түрі | Міндетті | Сипаттама | Мысал |
|---|---|---|---|---|
from | string (date) | иә | First day of the answer. | "2026-09-01" |
to | string (date) | иә | Last day of the answer. | "2026-09-30" |
grain | string | иә | Length of one period. day, month | |
measured | boolean | иә | Always false while the inputs of the model are assumptions and not counts. | false |
items | array of AudienceEstimate | иә | One row for each period, structure and approval with plays. | |
items[].period | string | иә | The day (YYYY-MM-DD) or the month (YYYY-MM), by the grain. | "2026-09" |
items[].structure | string | иә | Code of the structure. | "ALM-0012" |
items[].approval_number | string | иә | Number of the approval the plays belong to. | "TNB-2026-000123" |
items[].plays | integer | иә | Plays in the period. | 14210 |
items[].complete_plays | integer | иә | Plays that ran to the end; only these enter the estimate. | 13980 |
items[].impressions | number | иә | Estimated people who noticed the screen, from the model named in model. Not measured. | 21870.4 |
items[].model | string | null | иә | Code of the model version that gave the estimate; null when no model exists. | "audience-v1-draft" |
items[].model_status | string | null | иә | Whether that version is a draft (placeholder assumptions) or published. draft, published, <nil> |
Мысал
{
"from": "2026-09-01",
"to": "2026-09-30",
"grain": "month",
"measured": false,
"items": [
{
"period": "2026-09",
"structure": "ALM-0012",
"approval_number": "TNB-2026-000123",
"plays": 14210,
"complete_plays": 13980,
"impressions": 21870.4,
"model": "audience-v1-draft",
"model_status": "draft"
}
]
}
Қателер
Қателер problem құжаты (application/problem+json) түрінде, тұрақты code өрісімен келеді.
| Мәртебесі | Мағынасы |
|---|---|
| 401 | No valid session or API key (unauthenticated, session_expired, invalid_api_key). |
| 403 | The role or the key's scope does not allow this (forbidden, key_scope_denied, key_route_denied). |
| 422 | Field errors (validation_failed). |
| default | An error as a problem document. |
Код мысалдары
curl
curl 'https://app.tanba-ooh.kz/api/v1/stats/audience' \
-H 'Authorization: Bearer YOUR_API_KEY'
Python
import requests
response = requests.get(
"https://app.tanba-ooh.kz/api/v1/stats/audience",
headers={
"Authorization": "Bearer YOUR_API_KEY",
},
)
print(response.status_code, response.text)
Go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://app.tanba-ooh.kz/api/v1/stats/audience", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
data, _ := io.ReadAll(resp.Body)
fmt.Println(resp.Status, string(data))
}