TAŇBA-OOH Әзірлеушілерге

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, monthday
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

АтауыТүріМіндеттіСипаттамаМысал
fromstring (date)иәFirst day of the answer."2026-09-01"
tostring (date)иәLast day of the answer."2026-09-30"
grainstringиәLength of one period. day, month
measuredbooleanиәAlways false while the inputs of the model are assumptions and not counts.false
itemsarray of AudienceEstimateиәOne row for each period, structure and approval with plays.
items[].periodstringиәThe day (YYYY-MM-DD) or the month (YYYY-MM), by the grain."2026-09"
items[].structurestringиәCode of the structure."ALM-0012"
items[].approval_numberstringиәNumber of the approval the plays belong to."TNB-2026-000123"
items[].playsintegerиәPlays in the period.14210
items[].complete_playsintegerиәPlays that ran to the end; only these enter the estimate.13980
items[].impressionsnumberиәEstimated people who noticed the screen, from the model named in model. Not measured.21870.4
items[].modelstring | nullиәCode of the model version that gave the estimate; null when no model exists."audience-v1-draft"
items[].model_statusstring | 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 өрісімен келеді.

МәртебесіМағынасы
401No valid session or API key (unauthenticated, session_expired, invalid_api_key).
403The role or the key's scope does not allow this (forbidden, key_scope_denied, key_route_denied).
422Field errors (validation_failed).
defaultAn 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))
}