• How to schedule a transcoder by using the Wowza Streaming Cloud REST API

    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.

    Contents


    Create a live stream or transcoder
    Create a schedule
    Enable or disable a schedule
    Related requests

    Create a live stream or transcoder


    1. 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:


    2. 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.

    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

    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.

    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 --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" -d '{
       "schedule": {
         "action_type": "start",
         "name": "StartOneTimeSchedule",
         "recurrence_type": "once",
         "start_transcoder": "2015-12-26 20:00:00",
         "transcoder_id": "1234abcd"
       }
     }' "https://api.cloud.wowza.com/api/v1/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 --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" -d '{
       "schedule": {
         "action_type": "stop",
         "name": "StopOneTimeSchedule",
         "recurrence_type": "once",
         "stop_transcoder": "2015-12-26 21:00:00",
         "transcoder_id": "1234abcd"
       }
     }' "https://api.cloud.wowza.com/api/v1/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 --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [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"
       }
     }' "https://api.cloud.wowza.com/api/v1/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 --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [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"
       }
     }' "https://api.cloud.wowza.com/api/v1/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 --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [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"
       }
     }' "https://api.cloud.wowza.com/api/v1/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 --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/schedules/[schedule_id]/disable"
    Enable a schedule:

    curl -X PUT --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/schedules/[schedule_id]/enable"

    Related requests


    View a schedule's state:

    curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/schedules/[schedule_id]/state"
    Possible schedule states are enabled, disabled, and expired.

    View the details of a schedule:

    curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/schedules/[schedule_id]"
    Update a schedule's configuration:

    curl -X PATCH --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" -d '{
       "schedule": {
         "name": "DifferentScheduleName"
       }
     }' "https://api.cloud.wowza.com/api/v1/schedules/[schedule_id]"
    Delete a schedule:

    curl -X DELETE --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/v1/schedules/[schedule_id]"

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

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