Get viewer data for a Wowza CDN stream target with the Wowza Video REST API
Use the REST API to get viewer data for Wowza CDN stream targets in the Wowza Video™ service. Viewer data includes the number of unique viewers and viewing time for the stream target or the number of current viewers for an active stream. Wowza CDN on Fastly stream targets return near real-time viewer data.
Get viewer data for a stream target
See viewer data for a stream target by sending a
GET
request to the
/analytics/viewers/stream_targets/[stream_target_id]
endpoint.
You can use the following sample request, making sure to:
-
Set
from
andto
query parameters. This sets the range of time you want to view. The maximum difference betweenfrom
andto
is 90 days.
Sample request
curl -H "Authorization: Bearer ${WV_JWT}" \
-H "Content-Type: application/json" \
-X "GET" \
"${WV_HOST}/api/current/analytics/viewers/stream_targets/tvctq36g?from=2022-04-14T10:31:54.486Z&to=2022-07-13T10:31:54.486Z&include=countries,renditions,devices"
Sample response
The response includes:
-
Detailed information for all stream targets in the account,
including the stream target
ID
,viewers
,countires
,renditions
,devices
, andtrend
of usage for the target during the specified time frame.
{
{
"stream_target": {
"id": "tvctq36g",
"viewers": 7,
"countries": [
{
"code": "US",
"viewers": 4
},
{
"code": "DE",
"viewers": 3
}
],
"renditions": [
{
"name": 720,
"viewers": 7
}
],
"devices": [
{
"name": "Desktop",
"viewers": 7
}
],
"trend": [
{
"sampled_at": "2022-01-26T12:59:00.000Z",
"viewers": 7
},
{
"sampled_at": "2022-01-26T13:00:00.000Z",
"viewers": 7
}
]
},
"limits": {
"from": "2022-04-14T10:31:54.486Z",
"to": "2022-07-13T10:31:54.486Z"
}
}
}