Add Live Channel

Creates a live channel.

Request

Request syntax:

POST /channels

Request body parameters:

Pass the following request body parameters:

NameData TypeDescription
desc RequiredStringDefines the live channel's name.
external_idStringSets the live channel's external ID.
slicer_idStringIdentifies the live channel's Live Slicer by its case-sensitive ID. Default value: Omitting this property sets it to the live channel's system-defined ID.
use_chschedIntegerDetermines whether the live channel supports schedule entries. Valid values are: 1: Disabled 2: Enabled A live channel's support for schedule entries is determined upon its creation. After which, you may not modify this property. Default value: 1

Response

The response for a successful request contains the following properties:

NameData TypeDescription
@idStringIndicates the relative path to an endpoint that returns this live channel.
@typeStringReturns Channel.
ad_slateStringIndicates the asset that will be served for the live channel's ad slate by its system-defined ID (i.e., asset IDThis unique ID identifies an asset. View this ID by navigating to the Content tab, selecting the desired asset, and then viewing the GUID option from the Details tab.).
blackout_slateStringIndicates the asset that will be served for the live channel's blackout slate by its system-defined ID (i.e., asset IDThis unique ID identifies an asset. View this ID by navigating to the Content tab, selecting the desired asset, and then viewing the GUID option from the Details tab.). You may not use blackout with live channels that can leverage schedule entries.
createdStringIndicates the timestamp (UTC) at which the live channel was created. Syntax (ISO 8601): YYYY-MM-DDThh:mm:ss.sssZ
dash_urlStringIndicates the live channel's DASH playback URL.
descStringIndicates the live channel's name.
embed_domainsStringIndicates a comma-separated list of domains on which the live channel's embedded HTML5 player (embed_html5_player_url) may be hosted. Set this property to an empty value to authorize playback on any domain. Use an * as a wildcard character. Example: *.example.com,[www.example.org,www.example.\](http://www.example.org,www.example.\)\*
embed_html5_player_urlStringIndicates the URL for the live channel's embedded HTML5 player.
external_idStringIndicates the live channel's external ID.
hls_urlStringIndicates the live channel's HLS playback URL.
idStringIdentifies this live channel by its system-defined ID.
metaDictionaryContains the live channel's metadata fields. Each field is a key-value pair with the following syntax: 'Field Name': 'Field Value'
missing_content_slateStringIndicates the asset that will be served for missing content slate by its system-defined ID (i.e., asset IDThis unique ID identifies an asset. View this ID by navigating to the Content tab, selecting the desired asset, and then viewing the GUID option from the Details tab.).
overrideDictionaryuse_chsched = 2 Only Indicates whether a live channel's source is being overridden. This property returns an empty dictionary when the live channel's source is not being overridden.
override_slicer_idStringThe behavior of this property varies according to whether schedule entry support has been enabled on this live channel. Enabled (use_chsched = 2): This property has undergone end-of-life and therefore will not be included in the response. Disabled (use_chsched = 1): Indicates the ID of the Live Slicer that is currently overriding the live channel's source as a result of the /api2/channel/override endpoint. This property returns an empty string when the live channel's source is not being overridden by a different Live Slicer.
require_drmIntegerIndicates whether playback requires a digital signature. Valid values are: 0: Digital signatures are ignored. 1: Playback requests require a digital signature.
require_studio_drmIntegerIndicates whether Studio DRM will be enforced on this live channel. Valid values are: 0: Disabled. 1: Studio DRM is enforced on all playback requests for this live channel.
slicer_idStringIndicates the live channel's Live Slicer by its case-sensitive ID. This property returns no_slicer when a Live Slicer has not been assigned to the live channel.
test_playersList of dictionariesContains a list of restriction-free players through which you may test your live channel's feed.
thumb_urlStringIndicates the URL to a live channel's thumbnail preview image.
use_chschedIntegerIndicates whether the live channel supports schedule entries. Valid values are: 1: Disabled 2: Enabled A live channel's support for schedule entries is determined upon its creation. After which, you may not modify this property.

override Dictionary

The override dictionary contains the following properties when you are overriding the live channel's source:

NameData TypeDescription
idStringIdentifies a Live Slicer by its case-sensitive ID.
startStringIndicates the timestamp at which a live channel's source was overridden by the Live Slicer identified by the id property. Syntax: YYYY-MM-DDThh:mm:ss.ffffffZ Learn more.
typeStringReturns slicer when a live channel's source is being manually overridden.

test_players List

The test_players list describes each test player through the following properties:

NameData TypeDescription
descStringIndicates the test player's name.
idStringIndicates the test player's system-defined ID.
expireStringIndicates the test player's expiration date in Unix time (milliseconds).
paramsStringReserved for future use.
whitelistBooleanIndicates whether the test player will be placed on an allowlist.
urlStringIndicates the test player's URL.
url_html5StringIndicates the test player's HTML5 URL.
viewStringReserved for internal use.

Sample Request/Response

Call the add_live_channel module (Python 3) to create a live channel. This module imports names from the api_auth module.

import json, requests, datetime, time
from api_auth import APICredentials, APIParams

class LiveChannel:
    def __init__(self):
        self.host = "https://services.uplynk.com"

    def run(self):
        """
        Create a live channel.
        """
        self._create_live_channel()

    def _create_live_channel(self):
        url = "{}{}".format(self.host, "/api/v4/channels")

        payload = {
            'desc': 'My New Live Channel', # Replace with the live channel's name.
            'slicer_id': 'mySlicer1', # Replace with the desired Live Slicer ID.
            'use_chsched': 2 # Enables scheduling.
        }

        headers = {'Content-Type': 'application/json'}

        response = requests.post(
            url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers
        )

        print(response.json())

LiveChannel().run()

Response:

{
	'@id': '/channels/a6aa35d4b523498aab7227ed9510c138',
	'@type': 'Channel',
	'id': 'a6aa35d4b523498aab7227ed9510c138',
	'desc': 'My Live Channel',
	'created': '2021-04-30T16:19:48.215Z',
	'external_id': '',
	'use_chsched': 2,
	'ad_slate': '80292e78be6843fa8398827589748782',
	'blackout_slate': '860cbd66462a43b799ce044e6045f63d',
	'missing_content_slate': '48d8de0bdb0b4f2493310ad868525fb8',
	'embed_domains': '',
	'meta': {},
	'thumb_url': '',
	'slicer_id': 'MyLiveSlicer1',
	'hls_url': 'https://content.uplynk.com/channel/a6aa35d4b523498aab7227ed9510c138.m3u8',
	'dash_url': 'https://content.uplynk.com/channel/a6aa35d4b523498aab7227ed9510c138.mpd',
	'test_players': [{
			'desc': '5ExtMIB5AUzLtAAYvNF2NG',
			'id': '5ExtMIB5AUzLtAAYvNF2NG',
			'expire': None,
			'params': '',
			'whitelist': False,
			'url': 'https://content.uplynk.com/player/5ExtMIB5AUzLtAAYvNF2NGsc.html',
			'url_html5': 'https://content.uplynk.com/player5/5ExtMIB5AUzLtAAYvNF2NGsc.html'
		}
	],
	'embed_html5_player_url': 'https://content.uplynk.com/player5/32jMLROxrcW8JNFJNglmIVec.html',
	'require_drm': 1,
	'require_studio_drm': 0
}