Learn how to use the REST API to schedule a transcoder in the Wowza Streaming Cloud™ service to start and stop once, or on a repeating schedule.
Create a live stream or transcoder
- Using the Wowza Streaming Cloud REST API, create a live stream or a transcoder that receives video from a source encoder and delivers the stream to a hosted page or the transcoded output to a target. For instructions, see the following tutorials:
- Create an ABR stream and send it to a target with the Wowza Streaming Cloud REST API
- Pass a stream through the transcoder to a target with the Wowza Streaming Cloud REST API
- Get started with Wowza Streaming Cloud using the REST API
- Make note of the live_stream_id or transcoder_id that Wowza Streaming Cloud creates for your stream. You'll need it to schedule the broadcast.
Create a schedule
Create a schedule to start and stop the live stream or transcoder.
When specifying the start time, allow a few minutes for Wowza Streaming Cloud to launch the stream or transcoder. If your event begins at 9:00, for example, set the start time for 8:55. The minimum run time for a scheduled live stream or transcoder is 5 minutes, but we recommend scheduling at least 10 minutes between start and stop.
Schedule parameters
Parameter | Data Type | Description |
action_type | string | The schedule can either start, stop, or start and stop a transcoder. The default is start. Other valid values are stop and start_stop. |
end_repeat | string | If recurrence_type is recur, the month, day, and year that the recurring schedule stop running. Specify YYYY-MM-DD. |
name | string | A descriptive name for the schedule. Maximum 255 characters. |
recurrence_data | string | If recurrence_type is recur, the day or days of the week that the recurring schedule should start or stop the transcoder. Valid values are sunday, monday, tuesday, wednesday, thursday, friday, saturday, and sunday. |
recurrence_type | string | A schedule can run one time only (once) or repeat weekly or on multiple days of the week (recur) until a specified end date. The default is once. |
start_repeat | string | If recurrence_type is recur, the month, day, and year that the recurring schedule should go into effect. Specify YYYY-MM-DD. |
start_transcoder | string | If action_type is start, the month, day, year, and time of day that the transcoder should start running. Specify YYYY-MM-DD HH:MM:SS where HH is a 24-hour clock in UTC. |
stop_transcoder | string | If action_type is stop, the month, day, year, and time of day that the transcoder should stop running. Specify YYYY-MM-DD HH:MM:SS where HH is a 24-hour clock in UTC. |
transcoder_id | string | The unique alphanumeric string that identifies the transcoder or live stream being scheduled. |
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.
A schedule to start a transcoder once
The following request generates schedule that starts transcoder 1234abcd at 8pm UTC (20:00) on December 26, 2015.curl -X POST \ -H "Content-Type: application/json" \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ -d '{ "schedule": { "action_type": "start", "name": "StartOneTimeSchedule", "recurrence_type": "once", "start_transcoder": "2015-12-26 20:00:00", "transcoder_id": "1234abcd" } }' "${WSC_HOST}/api/${WSC_VERSION}/schedules"The request creates a schedule with an id parameter. By default, the schedule state is enabled. The details of the configured schedule are listed in the response, which should look something like this:
{ "schedule": { "action_type": "start", "created_at": "2015-11-25T11:53:28.508", "id": "5678efgh", "name": "StartOneTimeSchedule", "recurrence_type": "once", "start_transcoder": "2015-12-26T12:00:00.000", "state": "enabled", "transcoder_id": "1234abcd", "updated_at": "2015-11-25T11:53:28.508" } }
A schedule to stop a transcoder once
The following request generates a schedule that stops transcoder 1234abcd at 9pm UTC (21:00) on December 26, 2015, an hour after the transcoder starts.curl -X POST \ -H "Content-Type: application/json" \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ -d '{ "schedule": { "action_type": "stop", "name": "StopOneTimeSchedule", "recurrence_type": "once", "stop_transcoder": "2015-12-26 21:00:00", "transcoder_id": "1234abcd" } }' "${WSC_HOST}/api/${WSC_VERSION}/schedules"The request creates a schedule with an id parameter. By default, the schedule state is enabled. The details of the configured schedule are listed in the response, which should look something like this:
{ "schedule": { "action_type": "stop", "created_at": "2015-11-25T11:54:28.508", "id": "9123wxyz", "name": "StopOneTimeSchedule", "recurrence_type": "once", "state": "enabled", "stop_transcoder": "2015-10-26T13:00:00.000", "transcoder_id": "1234abcd", "updated_at": "2015-11-25T11:54:28.508" } }
A schedule to start and stop a transcoder for a one-time stream
The following request generates schedule that starts transcoder 1234abcd at 1pm UTC (13:00) on February 10, 2016 and stops the transcoder three hours later, at 4pm UTC (16:00) on February 10, 2016.curl -X POST \ -H "Content-Type: application/json" \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ -d '{ "schedule": { "action_type": "start_stop", "name": "ThreeHourTour", "recurrence_type": "once", "start_transcoder": "2016-02-10 13:00:00", "stop_transcoder": "2016-02-10 16:00:00", "transcoder_id": "1234abcd" } }' "${WSC_HOST}/api/${WSC_VERSION}/schedules"
A schedule to start a transcoder on Tuesdays and Thursdays for two weeks
The following request generates schedule that starts transcoder 1234abcd at 1pm UTC (13:00) every Tuesday and Thursday for the first two weeks of January 2016.curl -X POST \ -H "Content-Type: application/json" \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ -d '{ "schedule": { "action_type": "start", "end_repeat": "2016-01-14", "name": "tuesday-thursday", "recurrence_data": "tuesday,thursday", "recurrence_type": "recur", "start_repeat": "2016-01-01", "start_transcoder": "2016-01-05 13:00:00", "transcoder_id": "1234abcd" } }' "${WSC_HOST}/api/${WSC_VERSION}/schedules"
A schedule to stop a transcoder every day for a week
The following request generates schedule that stops transcoder 1234abcd at 2pm UTC (14:00) every day for seven days starting on February 10, 2016.curl -X POST \ -H "Content-Type: application/json" \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ -d '{ "schedule": { "action_type": "stop", "end_repeat": "2016-02-17", "name": "OneWeekInFeb", "recurrence_data": "wednesday,thursday,friday,saturday,sunday,monday,tuesday", "recurrence_type": "recur", "start_repeat": "2016-02-10", "stop_transcoder": "2016-02-10 14:00:00", "transcoder_id": "1234abcd" } }' "${WSC_HOST}/api/${WSC_VERSION}/schedules"
Enable or disable a schedule
By default, the state of every new schedule is enabled, which means the schedule will run automatically at the date and time specified. You can, however, disable and enable any schedule at any time.
Disable a schedule:
curl -X PUT \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ "${WSC_HOST}/api/${WSC_VERSION}/schedules/[schedule_id]/disable"Enable a schedule:
curl -X PUT \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ "${WSC_HOST}/api/${WSC_VERSION}/schedules/[schedule_id]/enable"
Related requests
View a schedule's state:
curl -X GET \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ "${WSC_HOST}/api/${WSC_VERSION}/schedules/[schedule_id]/state"
Possible schedule states are enabled, disabled, and expired.
View the details of a schedule:
curl -X GET \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ "${WSC_HOST}/api/${WSC_VERSION}/schedules/[schedule_id]"Update a schedule's configuration:
curl -X PATCH \ -H "Content-Type: application/json" \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ -d '{ "schedule": { "name": "DifferentScheduleName" } }' "${WSC_HOST}/api/${WSC_VERSION}/schedules/[schedule_id]"Delete a schedule:
curl -X DELETE \ -H "wsc-api-key: ${WSC_API_KEY}" \ -H "wsc-access-key: ${WSC_ACCESS_KEY}" \ "${WSC_HOST}/api/${WSC_VERSION}/schedules/[schedule_id]"