Update Blackout

Updates a blackout configuration.

Request

Request syntax:

PATCH /channels/Live Channel ID/blackouts/Blackout ID

Define the following variables 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.
Blackout ID RequiredIdentifies a blackout configuration by its system-defined or external ID. Use the Get Multiple Blackouts endpoint to retrieve a list of blackout configurations and their IDs.

Request body parameters:

Pass the following request body parameters:

NameData TypeDescription
blackout_idStringDefines 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 update_blackout module (Python 3) to update a specific blackout configuration. This module imports names from the api_auth module.

import json, requests
from api_auth import APICredentials, APIParams
channel_id = 'Hak3zjnPLSW5o0j8GMpzRMsa' # Replace with the ID for the desired live channel.
blackout_id = 'degf8923f093kfd932kd9fa4' # Replace with the ID for the desired blackout configuration.

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

    def run(self):
        """
        Update a blackout configuration.
        """
        self._update_blackout()

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

        payload = {
            'blackout_id': 'NorthAmerica', # Replace with the desired blackout ID.
        }

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

        response = requests.patch(
            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': 'NorthAmerica',
	'channel': '02ed9f65570746528e7b3d0628960025',
	'desc': 'Blackout North America',
	'external_id': '',
	'owner': 'abc123def456ghi789jkl012mno345pq',
	'rules': ['c5ce337d51f04b6da043cc7f28c9fef1']
}