Retrieves either all or recently updated blackout configurations associated with a specific live channel.
Request
Request syntax (time period):
GET /channels/Live Channel ID/blackouts?order=Sort Category&page=Page Number&page_size=Items Per Page
Request syntax (recently updated blackout configurations):
GET /channels/Live Channel ID/blackouts?after=Last Modified Time
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 query string parameters:
Pass the following optional request query string parameters:
Name | Description | |||
---|---|---|---|---|
after=Last Modified Time | Recently Updated Only Identifies a point-in-time for retrieving recently updated blackout configurations. The response will only include blackout configurations that were updated after this point-in-time. Specify a timestamp (ISO 8601 - milliseconds; UTC). The specified point-in-time may not exceed 10 minutes into the past. If you specify a point-in-time that is older than 10 minutes, then we will only return audiences that have been updated within the last 10 minutes. Syntax: YYYY-MM-DDThh:mm:ss.sssZ Example: after=2023-01-08T20:31:11.510Z | |||
order=Sort Category | Determines how blackout configurations will be sorted. Valid values are: blackout_id | created | desc | external_id Prepend a dash (-) to return results in reverse order. Example: Sorts blackout configurations from newest to oldest: order=-created |
page=Page Number | Filter the response by a specific page. Replace this variable with the desired page. Use the navigation links within the @links object to navigate between pages. Default Value: 1 | |||
page_size=Items Per Page | Sets the number of blackout configurations that may be included on each page. The number of items per page determines the number of pages that may be returned. The maximum page size is 40. Default value: 40 | |||
include_deleted | to-do: |
Response
A successful request returns a 200 OK response that contains the following properties:
Name | Data Type | Description |
---|---|---|
@id | String | Indicates the relative path to the requested endpoint. |
@type | String | Returns Collection. |
items | List of dictionaries | Contains a list of blackout configurations. |
total_items | Integer | Indicates the total number of blackout configurations. |
items List
The items list describes each rule configuration via 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
Call the get_multiple_blackouts module (Python 3) to retrieve the blackout configurations associated with a live channel. 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/Hak3zjnPLSW5o0j8GMpzRMsa/blackouts',
'@type': 'Collection',
'items': [{
'@id': '/api/v4/blackouts/4d585f7e0df24e25b14a45410ec836a7',
'@type': 'Blackout',
'id': '4d585f7e0df24e25b14a45410ec836a7',
'blackout_id': 'BSA',
'channel': 'Hak3zjnPLSW5o0j8GMpzRMsa',
'desc': 'Blackout South America',
'external_id': '',
'owner': 'abc123def456ghi789jkl012mno345pq',
'rules': ['f34e337d51f04b6da043cc7f28c9fef1']
}, {
'@id': '/api/v4/blackouts/309106a8d8994dd7886c7f8aedab3b66',
'@type': 'Blackout',
'id': '309106a8d8994dd7886c7f8aedab3b66',
'blackout_id': 'BNA',
'channel': 'Hak3zjnPLSW5o0j8GMpzRMsa',
'desc': 'Blackout North America',
'external_id': '',
'owner': 'abc123def456ghi789jkl012mno345pq',
'rules': ['c5ce337d51f04b6da043cc7f28c9fe46']
}
],
'total_items': 2
}