UnifiApi.Network.Traffic (UnifiApi v0.4.0)

Copy Markdown View Source

UniFi Network API (v2) — traffic time series.

Returns aggregated traffic counters over a configurable time window — per client and per destination country.

Requires cookie + CSRF authentication. See UnifiApi.Auth.Cookie.

Common params

  • :start — window start, unix milliseconds.
  • :end — window end, unix milliseconds (defaults to now if omitted).
  • :interval — bucket size: "hour", "day", "week".

Response shape

An array of buckets, each with time and the relevant counters (tx_bytes, rx_bytes, plus country/mac for the variant).

Summary

Functions

Returns per-client traffic breakdown over the time window.

Returns destination-country traffic breakdown over the time window.

Functions

by_client(client, site_id, opts \\ [])

@spec by_client(Req.Request.t(), String.t(), keyword()) ::
  {:ok, term()} | {:error, UnifiApi.Error.t()}

Returns per-client traffic breakdown over the time window.

by_country(client, site_id, opts \\ [])

@spec by_country(Req.Request.t(), String.t(), keyword()) ::
  {:ok, term()} | {:error, UnifiApi.Error.t()}

Returns destination-country traffic breakdown over the time window.