Add Blackout

Adds a blackout configuration to a live channel.

Request

Request syntax:

POST /channels/Live Channel ID/blackouts

Define the following variable when submitting the above request:

VariableA variable represents a value that must be replaced. A variable consists of either a URL segment (e.g., "0001" in /0001/) or a query string value (e.g., "3" in mediaTypes=3).Description
Live Channel ID RequiredIdentifies a live channel by its system-defined ID.

Request body parameters:

Pass the following request body parameters:

NameData TypeDescription
blackout_id RequiredStringDefines the blackout ID that identifies programming that should be blacked out. This value must be unique across all blackout configurations associated with a live channel. Learn how to tag programming with a blackout ID.
descStringDefines the name of the blackout configuration.
external_idStringDefines the external ID associated with this blackout configuration.
rulesList of string valuesContains the set of blackout rules associated with this blackout configuration. These rules identify audience(s) and the alternate content that should be streamed when programming has been tagged with the blackout ID defined within the blackout_id parameter. Identify each desired blackout rule by its system-defined ID.

Response

The response for a successful request contains the following properties:

NameData TypeDescription
@idStringIndicates the relative path to an endpoint that returns this blackout configuration.
@typeStringReturns Blackout.
blackout_idStringIndicates the blackout ID that identifies programming that should be blacked out. Learn how to tag programming with a blackout ID.
channelStringIndicates the system-defined ID for the live channel associated with this blackout configuration.
descStringIndicates the name of the blackout configuration.
external_idStringIndicates the external ID associated with this blackout configuration.
idStringIdentifies this blackout configuration by its system-defined ID.
ownerStringIndicates the system-defined ID for the user that owns this blackout configuration.
rulesList of string valuesContains the set of blackout rules associated with this blackout configuration. These rules identify audience(s) and the alternate content that should be streamed when programming has been tagged with the blackout ID defined within the blackout_id parameter. Each value identifies a blackout rule by its system-defined ID.

Sample Request/Response

Call the add_blackout module (Python 3) to add a blackout configuration to a live channel. This module imports names from the api_auth module.

import json, requests
from api_auth import APICredentials, APIParams
channel_id = '02ed9f65570746528e7b3d0628960025' # Replace with the ID for the desired live channel.

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

    def run(self):
        """
        Adds a blackout configuration to a live channel.
        """
        self._create_blackout()

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

        payload = {
            'desc': 'Blackout North America', # Replace with the live channel's name.
            'blackout_id': 'BNA', # Replace with the desired blackout ID.
            'rules': ['abce337d51f04b6da043cc7f28c9fe2f'] # Replace with the ID for the desired blackout rule.
        }

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

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

        print(response.json())

Blackout().run()

Response:

{
	'@id': '/api/v4/channels/02ed9f65570746528e7b3d0628960025/blackouts/f29106a8d8994dd7886c7f8aedab3b77',
	'@type': 'Blackout',
	'id': 'f29106a8d8994dd7886c7f8aedab3b77',
	'blackout_id': 'BNA',
	'channel': '02ed9f65570746528e7b3d0628960025',
	'desc': 'Blackout North America',
	'external_id': '',
	'owner': 'abc123def456ghi789jkl012mno345pq',
	'rules': ['c5ce337d51f04b6da043cc7f28c9fef1']
}