v4
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 Required | Identifies a live channel by its system-defined ID. |
Request body parameters:
Pass the following request body parameters:
Name | Data Type | Description |
---|---|---|
blackout_id Required | String | Defines 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. |
desc | String | Defines the name of the blackout configuration. |
external_id | String | Defines the external ID associated with this blackout configuration. |
rules | List of string values | Contains 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:
Name | Data Type | Description |
---|---|---|
@id | String | Indicates the relative path to an endpoint that returns this blackout configuration. |
@type | String | Returns Blackout. |
blackout_id | String | Indicates the blackout ID that identifies programming that should be blacked out. Learn how to tag programming with a blackout ID. |
channel | String | Indicates the system-defined ID for the live channel associated with this blackout configuration. |
desc | String | Indicates the name of the blackout configuration. |
external_id | String | Indicates the external ID associated with this blackout configuration. |
id | String | Identifies this blackout configuration by its system-defined ID. |
owner | String | Indicates the system-defined ID for the user that owns this blackout configuration. |
rules | List of string values | Contains 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
The code below (Python 3) shows how to add a blackout configuration to a live channel.
This code imports names from the api_auth
module for V4 APIs (see below).
🦉
API Auth for Classic Authentication (V4 APIs)
Open Recipe
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']
}