Restream an asset with the Wowza Video REST API (1.x legacy API)
The Wowza Video™ Asset Manager allows users to ingest, store, and tag video content in order to centralize, reuse, amplify, and provide user-friendly access to assets. See Video CMS: What it is and why you need one for more information.
Info
- This topic only applies to version 1.x of the REST API.
- You must obtain a license for the Asset Manager as part of your Wowza Video subscription to add this capability to your account. Contact us for more information.
This article demonstrates how to create a live stream associated with your .mp4 using the Wowza Video REST API.
Before you start
You should be familiar with the following concepts:
- API authentication methods . We use JSON web tokens for API authentication. See Authentication for more information.
- Environment variables . We use environment variables for the API version and your JWT in the cURL API request examples in this topic to make it easier for you to copy, paste, and run commands in your Terminal or Command Prompt window. If you don't set environment variables for these values, you'll need to manually enter the correct values in the code samples throughout this tutorial. See Tools for testing the API for instructions.
You should complete the following tasks:
- Create an asset . See Upload an Asset with the Wowza Video REST API to learn how.
1. Retrieve your asset ID
Locate your asset ID by sending a GET
request to the /assets
endpoint.
Sample request
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${WV_JWT}" \
-X "${WV_HOST}/api/${WV_VERSION}/assets"
Sample response
The response includes:
-
A list of assets. You'll need to find the asset you want to restream
and record the
id
.
{
"assets": [
{
"id": "1ttmionz",
"name": "test1.mp4",
"created_at": "2022-03-23T16:56:09.108Z",
"updated_at": "2022-03-23T16:56:10.219Z",
"published": false,
"thumbnail_url": null,
"state": "uploading",
"processing_percentage": 0.0,
"file_size": 0,
"playback_url": null,
"download_url": null,
"file_name": "test1.mp4"
},
{
"id": "paprtlx9",
"name": "guardians_multi.mp4",
"created_at": "2022-03-17T16:19:04.908Z",
"updated_at": "2022-03-17T16:36:04.779Z",
"published": false,
"thumbnail_url": "https://storage.googleapis.com/qa-wse-recordings/frP7Drv3/recording_whhvnjyb/whhvnjyb_thumbnail.jpg",
"state": "completed",
"processing_percentage": 100.0,
"file_size": 269788414,
"playback_url": "https://cdn3-qa.wowza.com/2/QlRpZ0JNOGxrQW1V/MUdHa29O/hls/lc6jv5jj/playlist.m3u8",
"download_url": "https://storage.googleapis.com/qa-wse-recordings/frP7Drv3/recording_whhvnjyb/guardians_multi.mp4",
"file_name": "guardians_multi.mp4"
}
],
"pagination": {
"payload_version": 2.0,
"total_records": 112,
"page": 1,
"per_page": 15,
"total_pages": 8,
"page_first_index": 0,
"page_last_index": 14
}
}
2. Restream your asset
Restream your asset by sending a POST
request to the /assets/{id}/live_streams
endpoint.
You can use the following sample request, making sure to:
-
Set
id
to the id of the asset returned in Step 1.
Sample request
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${WV_JWT}" \
-X "${WV_HOST}/api/${WV_VERSION}/assets/{id}/live_streams"
Sample response
The response includes:
-
An
id
for the live stream that you can use to re-stream an uploaded asset.
{
"live_streams": {
"name": "Restreamed Asset (k9xje4kq)",
"id": "i8qsbwvi",
}
}
3. Start a live stream
Now that you have created a live stream, you'll need to start it. See Quickly start a live stream for more information.