Get viewer data for a Wowza CDN stream target with the Wowza Streaming Cloud REST API

Use the REST API to get near real-time viewer data for Wowza CDN on Fastly stream targets in the Wowza Streaming Cloud™ 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.

Viewer data parameters


Parameter Data Type Description
from datetime The start of the range of time you want to view. Specify YYYY-MM-DD HH:00:00 where HH is a 24-hour clock in UTC. The range doesn't include hours and minutes, and it rounds minutes up to the hour. The maximum difference between from and to is 90 days. If you set the from query parameter without setting the to query parameter, the data returned will reflect 90 days starting at the from date, or data up to to the current day, whichever is shorter. The from default is the last billing date.
stream_target_id string

The unique alphanumeric string that identifies the stream target.

to datetime The end of the range of time you want to view. Specify YYYY-MM-DD HH:00:00 where HH is a 24-hour clock in UTC. The range doesn't include hours and minutes, and it rounds minutes up to the hour. The maximum difference between from and to is 90 days. If you set the to query parameter without setting the from query parameter, the data returned will be from the past 90 days or from your last invoice date, whichever is shorter. The to default is the end of the current day.

Get viewer data for a stream target


To see viewer data for a stream target, call the resource

https://api.cloud.wowza.com/api/[version]/usage/stream_targets/[stream_target_id]

Notes:

Example request and response

curl -X GET \
-H "wsc-api-key: ${WSC_API_KEY}" \
-H "wsc-access-key: ${WSC_ACCESS_KEY}" \
"${WSC_HOST}/api/${WSC_VERSION}/usage/stream_targets/[stream_target_id]?from=2019-08-04 15:00:00&to=2019-9-04 15:00:00"

The response provides detailed information for a single stream target, including the stream target ID, type of target, unique viewers, viewing time, total bytes of usage for the target, and bytes of usage per billing zone.

{
    "stream_target": {
        "id": "nlyjx123",
        "type": "fastly",
        "unique_viewers": 35,
        "viewing_time": 181040,
        "bytes": 37073299545,
        "zones": [
            {
                "name": "global",
                "type": "fastly",
                "bytes": 37073299545
            }
        ],
        "limits": {
            "from":"2019-08-04T15:00:00.000Z",
            "to": "2019-09-04T15:00:00.000Z"
        }
    }
}

Related request

Fetch live viewer data for a single stream target:

curl -X GET \
-H "wsc-api-key: ${WSC_API_KEY}" \
-H "wsc-access-key: ${WSC_ACCESS_KEY}" \
"${WSC_HOST}/api/${WSC_VERSION}/usage/stream_targets/[stream_target_id]/live"

The response provides the ID for a single stream target and near real-time data on the number of unique viewers for that target within the last 5 minutes.