Learn how to get paginated results from REST API queries made in the Wowza Streaming Cloud™ service.
About paginated results
The Wowza Streaming Cloud REST API allows you to retrieve a paginated view of results from any GET request made to the following endpoints:
- /live_streams
- /players
- /recordings
- /schedules
- /stream_sources
- /stream_targets
- /transcoders
- /vod_streams
Pagination query parameters
Parameter | Data Type | Description |
page | integer | Specify a positive integer to indicate which page of the results should be displayed. The default value is 1. |
per_page | integer | Indicates how many records should be included on each page of results. A valid value is any positive integer. The default is 1000. |
Oldest records are displayed first and newest records last. Results display the following additional parameters:
Parameter | Data Type | Description |
payload_version | integer | The pagination object version. |
page | integer | The page being displayed. |
page_first_index | integer | The 0-based index of the first record on the page returned. |
page_last_index | integer | The 0-based index of the last record on the page returned. |
per_page | integer | The number of records included on each page of results. |
total_pages | integer | The total number of pages generated by the query. |
total_records | integer | The total number of records in the database that match the query. |
Example requests
Notes:
- To authenticate API requests, use HMAC authentication for production environments. For testing or proof of concept purposes only, use API key and access key authentication.
- The curl examples below use environment variables. See Using cURL for more information on how to set these up.
curl -X GET \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ "${WSC_HOST}/api/${WSC_VERSION}/live_streams/?page=1&per_page=25"
This request generates a paginated list of live streams that shows 25 streams per page. The first page of results will display the 25 oldest streams. The response should look something like this:
{ "live_streams": [ { "id": "rtL9S9mf", "name": "My Live Stream", "created_at": "2020-03-23T17:40:34.000Z", "updated_at": "2020-03-25T01:16:12.000Z" }, ... ], "pagination": { "payload_version": 1.0, "total_records": 541, "page": 1, "per_page": 25, "total_pages": 22, "page_first_index": 0, "page_last_index": 24 } }
Stream targets and VOD streams usage
Slightly different parameters are required when querying the usage/stream_targets and usage/vod_streams endpoints.
Note: The workflow described in this section is only valid for v1.5 of the REST API and later.
Pagination query parameters
Parameter | Data Type | Description |
next_page_key | integer | Specify a page key ID to indicate which page of the results should be displayed. The key ID of the next page of results is returned in the response. |
per_page | integer | Indicates how many records should be included on each page of results. A valid value is any positive integer. The default is 1000. |
Results display the following additional parameters:
Parameter | Data Type | Description |
payload_version | integer | The pagination object version. |
total_records | integer | The total number of records in the database that match the query. |
next_page_key | string | The key ID of the next page of results. |
per_page | integer | The number of records included on each page of results. |
total_pages | integer | The total number of pages generated by the query. |
Example requests
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?next_page_key=1lk0syln&per_page=10"
This request generates a paginated list of stream targets that shows 10 stream targets per page. The response should look something like this:
{ "stream_targets": [ { "id": "1bwvmtlv", "name": "My Stream Target", "archived": false, "type": "fastly", "unique_viewers": 0, "viewing_time": 0, "bytes": 2547 }, ... ], "pagination": { "payload_version": 2.0, "total_records": 269, "next_page_key": "2jj8syfl", "per_page": 10, "total_pages": 27 } }