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

Estimated audience as CSV

GET /api/v1/exports/audience.csv

https://app.tanba-ooh.kz/api/v1/exports/audience.csv

Анықтамалықтың техникалық мәтіні ағылшын тілінде жазылған.

Scope read:stats. The same rows as GET /api/v1/stats/audience and the same query; the column estimated_impressions is an estimate from the model named in the row, not a measurement.

Аутентификация

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
sepсұрауstringжоқColumn separator; semicolon for spreadsheets set to a comma decimal mark. comma, semicoloncomma

Жауаптар

200 UTF-8 CSV with a byte-order mark and a header row.

text/csv

Мысал

string

Қателер

Қателер 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/exports/audience.csv' \
  -H 'Authorization: Bearer YOUR_API_KEY'
Python
import requests

response = requests.get(
    "https://app.tanba-ooh.kz/api/v1/exports/audience.csv",
    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/exports/audience.csv", 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))
}