# Query a live stream using the Wowza Video REST API Learn how to use the Wowza Videoâ„¢ service's REST API to gather information about an existing live stream, to update the live stream, and to delete the live stream. Info For information on the Wowza Video free trial and its feature limitations, see Wowza Video free trial. ## Start the live stream Before using the Wowza Video REST API to query and update a live stream, create and start a live stream with the user interface. 1. If you haven't already added a live stream, see [Get started with Wowza Video](/docs/wowza-video/quick-start/start-live-streaming) to learn how to add one. You'll need the JWT for API authentication that you created in that tutorial to complete this tutorial. See [Authentication](/docs/wowza-video/about-the-rest-api/authentication) for more information. 2. To start the live stream in Wowza Video, select **Available Streams**, select the stream on the **Live Streams** page, and then click **Start Live Stream** at the top of the Live Stream Detail page. ## Query for information about the live stream Now that you have a live stream that's started, use the following example requests to find information about the live stream. Example requests are presented in curl using environment variables, but you can also use a GUI REST client for API testing such as Postman or Paw. If you have basic questions about using a REST API, start with [About the Wowza Video REST API](/docs/wowza-video/about-the-rest-api/api-overview). Info The curl examples below use environment variables, `${WSC_API_KEY} `, `${WSC_ACCESS_KEY} `, `${WSC_VERSION} `, and `${WSC_HOST} ` for the Wowza Video API key, access key, version number, and your host. See [Using cURL](/docs/wowza-video/about-the-rest-api/api-overview/#tools-for-testing-the-api) for more information on how to set these up. - Query for all live streams in your account to find the details of your existing live stream. You'll need the ID of your live stream to do additional requests. Fetch all live streams: ``` curl -X GET \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/live_streams" ``` - View a live stream's state: ``` curl -X GET \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/live_streams/[live_stream_id]/state" ``` Possible live stream states are `starting`, `stopping`, `started`, `stopped`, and `resetting`. - View the details of a running live stream: ``` curl -X GET \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/live_streams/[live_stream_id]/stats" ``` - View a live stream's preview image: ``` curl -X GET \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/live_streams/[live_stream_id]/thumbnail_url" ``` ## Update the live stream Use the following example request to update the name of the live stream. You don't have to stop the live stream to update its configuration. - Update a live stream's configuration: ``` curl -X PATCH \ -H "Authorization: Bearer ${WV_JWT}" \ -d '{ "live_stream": { "name": "MyDifferentLiveStreamName" } }' "${WV_HOST}/api/${WV_VERSION}/live_streams/[live_stream_id]" ``` ## View data and health metrics for a live stream You can use the Wowza Video REST API to view stream health metrics, usage, and viewer data for a live stream. See these articles for more information: - [View stream health metrics by using the Wowza Video REST API](/docs/wowza-video/guides/insights-and-analytics/view-stream-health-metrics) - [View usage data by using the Wowza Video REST API](/docs/wowza-video/guides/insights-and-analytics/view-usage-data) - [Get viewer data for a Wowza CDN stream target by using the Wowza Video REST API](/docs/wowza-video/guides/insights-and-analytics/get-viewer-data-for-a-wowza-cdn-target) ## Delete the live stream When you are done viewing information about a live stream, you can stop it and delete it. - Stop the live stream: ``` curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/live_streams/[live_stream_id]/stop" ``` - Delete the live stream: ``` curl -X DELETE \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/live_streams/[live_stream_id]" ``` ## More resources - [Quickly start live streaming using the Wowza Video REST API](/docs/wowza-video/quick-start/start-live-streaming) - Wowza Video REST API Reference Documentation