• How to view usage data by using the Wowza Streaming Cloud REST API

    Learn how to use the REST API to get usage data for an account in the Wowza Streaming Cloud™ service. Usage data includes stream processing time for transcoders, network usage for stream sources and stream targets, egress for transcoders, and peak recording storage.

    Contents


    Usage parameters
    View stream processing time
    View network usage for stream sources
    View network usage for stream targets
    View network usage for transcoders
    View peak recording storage
    Get viewer data for a stream target

    Usage parameters


    Parameter Data Type Description
    billing_mode string For transcoder network usage (egress) and stream processing time.

    Specify the billing mode of the transcoder, either pay_as_you_go or twentyfour_seven.

    To retrieve usage for both pay-as-you-go and 24x7 streams, don't specify billing_mode.
    from datetime The start of the range of time you want to view. Specify YYYY-MM-DD HH:MM:SS where HH is a 24-hour clock in UTC. The default time range is from the last billing date to the end of the current day.
    to datetime The end of the range of time you want to view. Specify YYYY-MM-DD HH:MM:SS where HH is a 24-hour clock in UTC. The default time range is from the last billing date to the end of the current day.
    transcoder_type string For transcoder network usage (egress) and stream processing time.

    Specify transcoded to fetch stream processing time for all adaptive bitrate transcoders and live streams during the specified timeframe.

    Specify passthrough to fetch processing time for all passthrough transcoders during the specified timeframe.

    Don't specify transcoder_type to retrieve usage for both transcoded and passthrough streams.

    View stream processing time


    Stream processing time is the amount of time the Wowza Streaming Cloud transcoder spends processing encoded source video. Stream processing time is calculated separately for streams on which transcoding is performed and streams that are passed through the transcoder and delivered, unmodified, straight to a player or target.

    To view stream processing time, call the resource

    https://api.cloud.wowza.com/api/v1/usage/time/transcoders

    Example request and response

    Note: In all code examples, for [key], substitute your API key or your access key as appropriate. For more information, see Locating and using API and access keys.
    curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/usage/time/transcoders?transcoder_type=transcoded&billing_mode=pay_as_you_go"
    The query returns details on each transcoding session during the specified timeframe.

    Note: Stream processing time updates in or near real-time. Billing information updates every 12 hours. As a result, seconds_used and seconds_billed may differ.
    {
       "transcoders": [
         {
           "deleted": false,
           "id": "1234abcd",
           "name": "July 1 IP Camera",
           "seconds_billed": 20134,
           "seconds_used": 20134
         },
         {
           "deleted": false,
           "id": "1235abcd",
           "name": "July 1 GoCoder",
           "seconds_billed": 1234,
           "seconds_used": 1234
         },
         {
           "deleted": true,
           "id": "1236abcd",
           "name": "July 7 Transcoder East",
           "seconds_billed": 718,
           "seconds_used": 718
         }
      ]
     }

    View network usage for stream sources


    Network usage for stream sources is the amount of data that went through every Wowza Streaming Cloud stream source.

    To view network usage for stream sources, call the resource

    https://api.cloud.wowza.com/api/v1/usage/network/stream_sources

    Example request and response

    curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/usage/network/stream_sources?from=2015-07-01 12:00:00&to=2015-07-16 12:00:00"
    The query returns details on each stream source that received data during the specified timeframe.

    Note: Network usage updates approximately every hour and is subject to a three-hour delay. Billing information updates every 12 hours. As a result, bytes_used and bytes_billed may differ.
    {
       "stream_sources": [
         {
           "bytes_billed": 56054502,
           "bytes_used": 56054502,
           "deleted": true,
           "id": "5678efgh",
           "name": "Test stream 1 / Stream Source"
         },
         {
           "bytes_billed": 36267914,
           "bytes_used": 36267914,
           "deleted": true,
           "id": "5679efgh",
           "name": "Test stream 2 / Stream Source"
         }, 
         {
           "bytes_billed": 643536711,
           "bytes_used": 643536711,
           "deleted": true,
           "id": "5670efgh",
           "name": "Test stream 3 / Stream Source"
         }
       ]
     }

    View network usage for stream targets


    Network usage for stream targets is the amount of data that went through every Wowza Streaming Cloud stream target.

    To view network usage for stream targets, call the resource

    https://api.cloud.wowza.com/api/v1/usage/network/stream_targets

    Example request and response

    curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/usage/network/stream_targets"
    The query returns details on each stream target that received data during the specified timeframe.

    Note: Network usage updates approximately every hour and is subject to a three-hour delay. Billing information updates every 12 hours. As a result, bytes_used and bytes_billed may differ.
    {
       "stream_targets": [
         {
           "bytes_billed": 699335564,
           "bytes_used": 699335564,
           "deleted": false,
           "id": "9123wxyz",
           "name": "RTMP-Pull-Street / CDN Target"
         },
         {
           "bytes_billed": 56567898,
           "bytes_used": 56567898,
           "deleted": false,
           "id": "9124wxyz",
           "name": "GoCoder stream / Transcoder / Stream Target"
         },
         {
           "bytes_billed": 13531611,
           "bytes_used": 13531611,
           "deleted": false,
           "id": "9125wxyz",
           "name": "Test stream 4 / Stream Target"
         }
       ]
     }

    View network usage for transcoders


    Transcoder network usage (egress) includes traffic leaving Wowza Streaming Cloud for Wowza CDN and custom stream targets.

    To view transcoder egress, call the resource

    https://api.cloud.wowza.com/api/v1/usage/network/transcoders

    Example request and response

    curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/usage/network/transcoders?from=2015-07-01 12:00:00&to=2015-07-16 12:00:00"
    The query returns details on all transcoder usage during the specified timeframe.

    Note: Transcoder usage updates approximately in or near real-time. Billing information updates every 12 hours. As a result, bytes_used and bytes_billed may differ.
    {
       "transcoders": [
         {
           "bytes_billed": 53446778562,
           "bytes_used": 53446778562,
           "deleted": false,
           "id": "1237abcd",
           "name": "RTMP-Pull-Street"
         },
         {
           "bytes_billed": 119542733,
           "bytes_used": 119542733,
           "deleted": true,
           "id": "1238abcd",
           "name": "March 31 RTMP Pull test"
         },
         {
           "bytes_billed": 14109171,
           "bytes_used": 14109171,
           "deleted": true,
           "id": "1239abcd",
           "name": "an ip camera stream to record"
         }
       ]
     }

    View peak recording storage


    Peak recording storage is the greatest amount of recorded content stored in your Wowza Streaming Cloud account at any point in a given month. For example, if during the course of a month you record five live streams, delete two recordings and keep three recordings, your peak recording storage will be the amount of data stored for the five recordings.

    To view peak recording storage, call the resource

    https://api.cloud.wowza.com/api/v1/usage/storage/peak_recording

    Example request and response

    curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/usage/storage/peak_recording"
    The query returns the greatest amount of bytes stored in your account at any one point in the specified timeframe.

    {
       "peak_recording": {
         "bytes_total": 15130718193
       }
    }

    Get viewer data for a stream target


    Viewer data shows information for viewers who played the transcoded stream over Wowza CDN stream targets.

    To see viewer data, call the resource

    https://api.cloud.wowza.com/api/v1/usage/viewer_data/stream_targets

    Example request and response

    curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/usage/viewer_data/stream_targets?from=2015-07-01 12:00:00&to=2015-07-16 12:00:00"
    The query returns the viewer data for the stream target in the specified timeframe.

    Note: Viewer data is available about two hours after a transcoder stops running and then updates approximately hourly. Total unique viewers, however, begins to update approximately three hours after the stream starts and may take up to 48 hours to finalize after the stream ends.
    {
      "stream_target": {
        "countries": [
          {
            "US": {
              "name": "United States of America",
              "...": "...",
              "protocols": [
                {
                  "hds": {
                    "name": "Adobe HDS",
                    "...": "..."
                  }
                },
                {
                  "hls": {
                    "name": "Apple HLS",
                    "...": "..."
                  }
                },
                {
                  "rtmp": {
                    "name": "RTMP",
                    "...": "..."
                  }
                }
              ]
            }
          },
          {
            "CA": {
              "name": "Canada",
              "...": "..."
            }
          }
        ],
        "country_list": [
          "AU",
          "CA",
          "CH",
          "CZ",
          "DE",
          "FI",
          "GB",
          "IE",
          "IL",
          "IN",
          "MX",
          "PL",
          "SE",
          "US"
        ],
        "percentage_viewers": 100,
        "percentage_viewing_time": 100,
        "protocols": [
          {
            "hds": {
              "name": "Adobe HDS",
              "total_unique_viewers": 6693,
              "percentage_viewers": 39,
              "seconds_total_viewing_time": 24695388,
              "seconds_avg_viewing_time": 3689.7337516808607,
              "percentage_viewing_time": 55
            }
          },
          {
            "hls": {
              "name": "Apple HLS",
              "total_unique_viewers": 11397,
              "percentage_viewers": 67,
              "seconds_total_viewing_time": 20230110,
              "seconds_avg_viewing_time": 1775.0381679389313,
              "percentage_viewing_time": 45
            }
          },
          {
            "rtmp": {
              "name": "RTMP",
              "total_unique_viewers": 0,
              "percentage_viewers": 0,
              "seconds_total_viewing_time": 0,
              "seconds_avg_viewing_time": 0,
              "percentage_viewing_time": 0
            }
          }
        ],
        "rendition_list": [
          4128,
          2728,
          1728,
          1152,
          640,
          448
        ],
        "renditions": [
          {
            "448": {
              "countries": [
                {
                  "US": {
                    "name": "United States of America",
                    "...": "..."
                   }
                }
              ],
              "protocols": [
                {
                  "hds": {
                    "name": "Adobe HDS",
                    "...": "..."
                  }
                },
                {
                  "hls": {
                    "name": "Apple HLS",
                    "...": "..."
                  }
                },
                {
                  "rtmp": {
                    "name": "RTMP",
                    "...": "..."
                  }
                }
              ],
              "total_unique_viewers": 12453,
              "percentage_viewers": 100,
              "percentage_viewing_time": 100,
              "seconds_avg_viewing_time": 387.3736449048422,
              "seconds_total_viewing_time": 4823964
            }
            "640": {
              "...": "..."
            }
          }
        ],
        "seconds_avg_viewing_time": 2633.690819556806,
        "seconds_total_viewing_time": 44925498,
        "total_unique_viewers": 17058
      }
    }

    Originally Published: 01-21-2016.
    Updated: 11-28-2016.

    If you're having problems or want to discuss this article, post in our forum.