Use the Live Slicer Failover API, which is a versioned API, to perform the following tasks:
Endpoint | Description |
---|---|
PUT /failover-groups/Failover Group ID/activate_slicer
|
Sets a failover group's active Live Slicer. |
PUT /failover-groups/Failover Group ID/channels
|
Adds and removes live channels from a failover group. |
GET /failover-groups
|
Retrieves all failover groups. |
GET /failover-groups/Failover Group ID/allowed-owners
|
Retrieves a list of users that are allowed to use a failover group. |
GET /failover-groups/Failover Group ID
|
Retrieves a specific failover group. |
PUT /failover-groups/Failover Group ID/allowed-owners
|
Grants or denies authorization to a failover group. |
PUT /failover-groups/Failover Group ID/set_no_slicer
|
Toggles a failover group's feed between a Live Slicer and slate. |
Update Failover Group Configuration PATCH /failover-groups/Failover Group ID
|
Updates a failover group's failover mode, automatic failback, or both. |
Update Live Slicer Failover Eligibility PUT /failover-groups/Failover Group ID/slicers
|
Updates whether one or more Live Slicer(s) are eligible for failover. |
The Live Slicer Failover API uses our standard API authentication.
Use the following base URL:
Sets a failover group's active Live Slicer. Upon activating a Live Slicer, it will be assigned to all live channels associated with that failover group.
Do not use this endpoint with a failover group on which the Auto Failback option has been enabled. Attempting to use this endpoint on such a failover group generates a 400 Bad Request response.
Request syntax:
Request URL variable:
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 |
---|---|
Required |
Replace this variable with the system-defined ID assigned to the desired failover group. Use the Get All Failover Groups endpoint to retrieve a list of failover groups and their system-defined ID. |
Request body parameter:
Pass the following request body parameter:
Name |
Data Type |
Description |
---|---|---|
slicer_id Required |
String |
Identifies a Live Slicer by its ID. Our system uses this Live Slicer's feed to generate your live stream. You may only activate a Live Slicer that belongs to the failover group defined in the request URL. A Live Slicer's ID is determined by the slicerID setting in its configuration file How do I activate a Live Slicer that belongs to a different user?
You may activate a Live Slicer that belongs to a different user if it already belongs to the failover group defined in the request URL. Use the following syntax to activate a Live Slicer that belongs to a different userA user, which is a type of customer account, allows an individual user to manage their own Slicers / Live Slicers, live channels, live events, and content. If a user has been associated with an account, then that user may also leverage that account's shared configuration.: User ID:Live Slicer ID
Example: abc33864a92c46a1a286cdd49b0a9123:myslicer01
|
Pass a digital signature based off of msg.
The response for a successful request is a 204 No Content.
The response for an invalid request (e.g., trying to activate a Live Slicer that does not belong to the specified failover group) is a 400 Bad Request.
Call the activate_live_slicer module (Python 3) to set a failover group's active Live Slicer. This module imports names from the api_auth module.
import json import requests from api_auth import APICredentials, APIParams class ActivateLiveSlicer: def __init__(self): self.host = "https://services.uplynk.com" def run(self): self._activate_live_slicer() def _activate_live_slicer(self): failover_group_id = 'e8d6b5cb940c40cc9ec6ad081a38f3f0' # Replace with the ID for the desired failover group. url = "{}{}{}{}".format(self.host, "/api/v4/failover-groups/", failover_group_id, "/activate_slicer") payload = { 'slicer_id': 'myslicer01' } headers = {'Content-Type': 'application/json'} response = requests.put( url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers ) print(response.status_code) ActivateLiveSlicer().run()
Adds and removes live channels from a failover group.
Adding a live channel to a failover group automatically assigns the failover group's active Live Slicer to that live channel.
This endpoint does not replace the entire set of live channels associated with a failover group. Rather, it only adds or removes live channels from it.
Request syntax:
Request URL variable:
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 |
---|---|
Required |
Replace this variable with the system-defined ID assigned to the desired failover group. Use the Get All Failover Groups endpoint to retrieve a list of failover groups and their system-defined IDs. |
Request body parameters:
Pass the following request body parameters:
Name |
Data Type |
Description |
---|---|---|
channels_ids_to_add |
List of String Values |
Contains a list of the live channels that will be added to the failover group. Identify each desired live channel by its system-defined ID. You may only add a live channel if it does not belong to another failover group. Reassign a live channel to a different failover group by first removing it from its current failover group. |
channels_ids_to_remove |
List of String Values |
Contains a list of the live channels that will be removed from the failover group. Identify each desired live channel by its system-defined ID. |
Pass a digital signature based off of msg.
The response for a successful request is a 204 No Content.
The response for a request to add a live channel that is already assigned to a failover group is a 409 Conflict.
Call the add_remove_live_channels module (Python 3) to update the set of live channels associated with a failover group. This module imports names from the api_auth module.
import json import requests from api_auth import APICredentials, APIParams class FailoverGroup: def __init__(self): self.host = "https://services.uplynk.com" def run(self): self._add_remove_live_channels() def _add_remove_live_channels(self): failover_group_id = 'e8d6b5cb940c40cc9ec6ad081a38f3f0' # Replace with the ID for the desired failover group. url = "{}{}{}{}".format(self.host, "/api/v4/failover-groups/", failover_group_id, "/channels") payload = { 'channels_ids_to_add': [ 'c3481b4f12ae471d9b727a6e27ea4675', 'g341643dn409198f523flniu1234n34d' ], 'channels_ids_to_remove': [ 'h3481b4f12ae471d9b722a6e27ea4274' ] } headers = {'Content-Type': 'application/json'} response = requests.put( url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers ) print(response.status_code) FailoverGroup().run()
Retrieves all failover groups.
Request syntax:
Pass a digital signature based off of msg.
The response for a successful request contains the following properties:
Name |
Data Type |
Description |
---|---|---|
@id |
String |
Indicates the relative path to this endpoint. |
@type |
String |
Returns Collection. |
items |
List of dictionaries |
Contains a list of your failover groups. |
total_items |
String |
Indicates the total number of failover groups. |
The items list describes each failover group via the following properties:
Name |
Data Type |
Description |
---|---|---|
@id |
String |
Indicates the relative path to an endpoint that returns this failover group. |
@type |
String |
Returns FailoverGroup. |
id |
String |
Identifies this failover group by its system-defined ID. |
owner |
String |
Indicates the system-defined ID for the user that owns this failover group. |
name |
String |
Indicates the name assigned to this failover group. |
hot_warm |
Integer |
Indicates whether all Live Slicers within this failover group will be allowed to encode and store content. Valid values are:
|
mode |
String |
Indicates how our system chooses a Live Slicers upon failover. Valid values are: prioritized | flat
|
auto_failback |
Boolean |
Indicates whether our system will automatically switch back to the primary Live Slicer when it resumes a healthy state. |
failover_time |
Integer |
Indicates the date and time, in Unix time (milliseconds), for the last instance in which failover occurred. |
active_slicer_id |
String |
Indicates the system-defined ID for the active Live Slicer. Our system uses this Live Slicer's feed to generate your live stream. If the source for the failover group's feed has been switched to missing content slate, then this property returns no_slicer. |
channels |
List of Dictionaries |
Contains a list of the live channels associated with this failover group. |
slicers |
List of Dictionaries |
Contains a list of Live Slicers associated with this failover group. |
The channels list describes each live channel associated with your failover group via the following properties:
Name |
Data Type |
Description |
---|---|---|
id |
String |
Identifies this live channel by its system-defined ID. |
desc |
String |
Indicates the name assigned to this live channel. |
The slicers list describes each Live Slicer associated with your failover group via the following properties:
Name |
Data Type |
Description |
---|---|---|
id |
String |
Identifies this Live Slicer by its system-defined ID. |
blacklist_until |
Integer |
Indicates until when, in Unix time (milliseconds), an unhealthy Live Slicer will be ineligible to become the failover group's active Live Slicer. Key information:
|
order |
Integer |
Indicates the order, starting from 1, in which our system will choose Live Slicers upon failover. If the failover group uses flat mode (i.e., random Live Slicer selection), then this property will always return 1. |
status |
Dictionary |
Contains the Live Slicer's status and thumbnail URL. |
hostname |
String |
Indicates the Live Slicer's hostname. |
enabled |
Boolean |
Indicates whether failover has been enabled on the Live Slicer. |
status Dictionary
The status dictionary contains the following properties:
Name |
Data Type |
Description |
---|---|---|
state |
Integer |
Indicates the Live Slicer's status. Valid values are:
|
thumb_url |
String |
Indicates the URL to a thumbnail preview of the Live Slicer's output. |
Call the get_all_failover_groups module (Python 3) to retrieve all failover groups. This module imports names from the api_auth module.
import requests from api_auth import APICredentials, APIParams class FailoverGroups: def __init__(self): self.host = "https://services.uplynk.com" def run(self): self._get_failover_groups() def _get_failover_groups(self): url = "{}{}".format(self.host, "/api/v4/failover-groups") headers = {'Content-Type': 'application/json'} response = requests.get( url, params=APIParams(APICredentials()).get_params({}), headers=headers ) print(response.json()) FailoverGroups().run()
Response:
{ '@id': '/api/v4/failover-groups', '@type': 'Collection', 'items': [{ '@id': '/api/v4/failover-groups/9852b8646dea4cd0a48f5e0ffaa4f8b3', '@type': 'FailoverGroup', 'owner': 'ab533864a92b46a1a286cdd49b0a9bd3', 'id': '9852b8646dea4cd0a48f5e0ffaa4f8b3', 'name': 'My Failover Group', 'hot_warm': 0, 'mode': 'prioritized', 'auto_failback': True, 'failover_time': 1576107800205, 'active': None, 'active_slicer_id': 'news01', 'channels': [{ 'id': '478f6d24e1a643049cdba0c544830752', 'desc': 'Broadcast01' }, { 'id': 'aad717c2fda649a3b213c56c94b529f4', 'desc': 'Broadcast02' } ], 'slicers': [{ 'id': 'news01', 'blacklist_until': 0, 'order': 1, 'status': { 'state': 0, 'thumb_url': 'https://x-default-stgec.uplynk.com/ausw/slices/d7b/...000009C.jpg' }, 'hostname': '101-174-253-64.slicer.uplynk.net', 'enabled': True }, { 'id': 'news02', 'blacklist_until': 0, 'order': 2, 'status': { 'state': 0, 'thumb_url': 'https://x-default-stgec.uplynk.com/ausw/slices/d7b/...000003E.jpg' }, 'hostname': '104-174-253-63.slicer.uplynk.net', 'enabled': True } ] }, { '@id': '/api/v4/failover-groups/054d58556a7441cbbe71d4fb7f366422', '@type': 'FailoverGroup', 'owner': 'cb233864a92b46a1a286cdd49b0a9bc8', 'id': '054d58556a7441cbbe71d4fb7f366422', 'name': 'Premium Events', 'hot_warm': 0, 'mode': 'prioritized', 'auto_failback': True, 'failover_time': 1576090867072, 'active': None, 'active_slicer_id': 'sports01', 'channels': [{ 'id': 'c8929b67f1354607877b319edb0c01af', 'desc': 'Entertainment' }, { 'id': '6c1455e88af8428e999bacf69c7dd203', 'desc': 'Sports' } ], 'slicers': [{ 'id': 'sports01', 'blacklist_until': 0, 'order': 3, 'status': { 'state': -1, 'thumb_url': '' }, 'hostname': '190-16-26-22.slicer.uplynk.net', 'enabled': False }, { 'id': 'sports02', 'blacklist_until': 0, 'order': 4, 'status': { 'state': -1, 'thumb_url': '' }, 'hostname': '193-16-26-4.slicer.uplynk.net', 'enabled': False } ] } ], 'total_items': 2 }
Retrieves a list of users that are authorized to use a failover group.
Request syntax:
Request URL variable:
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 |
---|---|
Required |
Replace this variable with the system-defined ID assigned to the desired failover group. Use the Get All Failover Groups endpoint to retrieve a list of failover groups and their system-defined ID. |
Pass a digital signature based off of msg.
The response for a successful request contains the following properties:
Name |
Data Type |
Description |
---|---|---|
@id |
String |
Indicates the relative path to this endpoint. |
@type |
String |
Returns Collection. |
items |
List of dictionaries |
Contains a list of users that are authorized to use this failover group. |
total_items |
String |
Indicates the total number of authorized users. |
The response for a successful request contains the following properties:
Name |
Data Type |
Description |
---|---|---|
id |
String |
Reserved for future use. |
owner |
String |
Indicates the system-defined ID for a user that is authorized to use this failover group. |
failover_group_id |
String |
Identifies this failover group by its system-defined ID. |
Call the get_allowed_users module (Python 3) to retrieve a list of authorized users for a specific failover group. This module imports names from the api_auth module.
import requests from api_auth import APICredentials, APIParams class FailoverGroup: def __init__(self): self.host = "https://services.uplynk.com" def run(self): self._get_allowed_users() def _get_allowed_users(self): failover_group_id = 'e8d6b5cb940c40cc9ec6ad081a38f3f0' # Replace with the ID for the desired failover group. url = "{}{}{}{}".format(self.host, "/api/v4/failover-groups/", failover_group_id, "/allowed-owners") headers = {'Content-Type': 'application/json'} response = requests.get( url, params=APIParams(APICredentials()).get_params({}), headers=headers ) print(response.json()) FailoverGroup().run()
Response:
{ '@id': '/api/v4/failover-groups/054d58556a7441cbbe71d4fb7f366480/allowed-owners', '@type': 'Collection', 'items': [{ 'id': '52487b0f83c94c2d96c64672a4a8da37', 'failover_group_id': 'e8d6b5cb940c40cc9ec6ad081a38f3f0', 'owner': 't345643dn409198f523flniu1234n34i' }, { 'id': '23bh0cba29f44e87a6e049e00a8e90ae', 'failover_group_id': 'e8d6b5cb940c40cc9ec6ad081a38f3f0', 'owner': 'ff41643dn419198f523flniu1234n34i' } ], 'total_items': 2 }
Retrieves a failover group by its system-defined ID.
Request syntax:
Request URL variable:
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 |
---|---|
Required |
Replace this variable with the system-defined ID assigned to the desired failover group. Use the Get All Failover Groups endpoint to retrieve a list of failover groups and their system-defined ID. |
Pass a digital signature based off of msg.
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 failover group. |
@type |
String |
Returns FailoverGroup. |
id |
String |
Identifies this failover group by its system-defined ID. |
owner |
String |
Indicates the system-defined ID for the user that owns this failover group. |
name |
String |
Indicates the name assigned to this failover group. |
hot_warm |
Integer |
Indicates whether all Live Slicers within this failover group will be allowed to encode and store content. Valid values are:
|
mode |
String |
Indicates how our system chooses a Live Slicers upon failover. Valid values are: prioritized | flat
|
auto_failback |
Boolean |
Indicates whether our system will automatically switch back to the primary Live Slicer when it resumes a healthy state. |
failover_time |
Integer |
Indicates the date and time, in Unix time (milliseconds), for the last instance in which failover occurred. |
active_slicer_id |
String |
Indicates the system-defined ID for the active Live Slicer. Our system uses this Live Slicer's feed to generate your live stream. If the source for the failover group's feed has been switched to missing content slate, then this property returns no_slicer. |
channels |
List of Dictionaries |
Contains a list of the live channels associated with this failover group. |
slicers |
List of Dictionaries |
Contains a list of Live Slicers associated with this failover group. |
The channels list describes each live channel associated with your failover group via the following properties:
Name |
Data Type |
Description |
---|---|---|
id |
String |
Identifies this live channel by its system-defined ID. |
desc |
String |
Indicates the name assigned to this live channel. |
The slicers list describes each Live Slicer associated with your failover group via the following properties:
Name |
Data Type |
Description |
---|---|---|
id |
String |
Identifies this Live Slicer by its system-defined ID. |
blacklist_until |
Integer |
Indicates until when, in Unix time (milliseconds), an unhealthy Live Slicer will be ineligible to become the failover group's active Live Slicer. Key information:
|
order |
Integer |
Indicates the order, starting from 1, in which our system will choose Live Slicers upon failover. If the failover group uses flat mode (i.e., random Live Slicer selection), then this property will always return 1. |
status |
Dictionary |
Contains the Live Slicer's status and thumbnail URL. |
hostname |
String |
Indicates the Live Slicer's hostname. |
enabled |
Boolean |
Indicates whether failover has been enabled on the Live Slicer. |
The status dictionary contains the following properties:
Name |
Data Type |
Description |
---|---|---|
state |
Integer |
Indicates the Live Slicer's status. Valid values are:
|
thumb_url |
String |
Indicates the URL to a thumbnail preview of the Live Slicer's output. |
Call the get_failover_group module (Python 3) to retrieve a failover group. This module imports names from the api_auth module.
import requests from api_auth import APICredentials, APIParams class FailoverGroup: def __init__(self): self.host = "https://services.uplynk.com" def run(self): self._get_failover_group() def _get_failover_group(self): failover_group_id = 'e8d6b5cb940c40cc9ec6ad081a38f3f0' # Replace with the ID for the desired failover group. url = "{}{}{}".format(self.host, "/api/v4/failover-groups/", failover_group_id) headers = {'Content-Type': 'application/json'} response = requests.get( url, params=APIParams(APICredentials()).get_params({}), headers=headers ) print(response.json()) FailoverGroup().run()
Response:
{ '@id': '/api/v4/failover-groups/9852b8646dea4cd0a48f5e0ffaa4f8b3', '@type': 'FailoverGroup', 'owner': 'ab533864a92b46a1a286cdd49b0a9bd3', 'id': '9852b8646dea4cd0a48f5e0ffaa4f8b3', 'name': 'My Failover Group', 'hot_warm': 0, 'mode': 'prioritized', 'auto_failback': True, 'failover_time': 1576107800205, 'active': None, 'active_slicer_id': 'news01', 'channels': [{ 'id': '478f6d24e1a643049cdba0c544830752', 'desc': 'Broadcast01' }, { 'id': 'aad717c2fda649a3b213c56c94b529f4', 'desc': 'Broadcast02' } ], 'slicers': [{ 'id': 'news01', 'blacklist_until': 0, 'order': 1, 'status': { 'state': 0, 'thumb_url': 'https://x-default-stgec.uplynk.com/ausw/slices/d7b/...000009C.jpg' }, 'hostname': '101-174-253-64.slicer.uplynk.net', 'enabled': True }, { 'id': 'news02', 'blacklist_until': 0, 'order': 2, 'status': { 'state': 0, 'thumb_url': 'https://x-default-stgec.uplynk.com/ausw/slices/d7b/...000003E.jpg' }, 'hostname': '104-174-253-63.slicer.uplynk.net', 'enabled': True } ] }
Allows the user that owns a failover group to determine the set of users that are authorized to use it.
This endpoint does not replace the entire set of users that are authorized to use the failover group. Rather, it only adds or removes users from it.
Request syntax:
Request URL variable:
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 |
---|---|
Required |
Replace this variable with the system-defined ID assigned to the desired failover group. Use the Get All Failover Groups endpoint to retrieve a list of failover groups and their system-defined ID. |
Request body parameters:
Pass the following request body parameters:
Name |
Data Type |
Description |
---|---|---|
owners_to_add |
List of String Values |
Contains a list of the users that will be granted authorization to this failover group. Identify each desired user by its system-defined ID. |
owners_to_remove |
List of String Values |
Contains a list of the users whose authorization to this failover group will be revoked. Identify each desired user by its system-defined ID. |
Pass a digital signature based off of msg.
The response for a successful request is a 204 No Content.
Call the grant_deny_authorization module (Python 3) to grant or deny authorization to a failover group. This module imports names from the api_auth module.
import json import requests from api_auth import APICredentials, APIParams class FailoverGroup: def __init__(self): self.host = "https://services.uplynk.com" def run(self): self._add_remove_allowed_users() def _add_remove_allowed_users(self): failover_group_id = 'e8d6b5cb940c40cc9ec6ad081a38f3f0' # Replace with the ID for the desired failover group. url = "{}{}{}{}".format(self.host, "/api/v4/failover-groups/", failover_group_id, "/allowed-owners") payload = { 'owners_to_add': [ 'gu137664292b46a1a286cdf79b1a9bm8', 't341643dn409198f523flniu1234n34h' ], 'owners_to_remove': [ 'de137864292b46a1a286cdd79b3a9ba6' ] } headers = {'Content-Type': 'application/json'} response = requests.put( url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers ) print(response.status_code) FailoverGroup().run()
Toggles the source of a failover group's feed between a Live Slicer and slate.
Request syntax:
Request URL variable:
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 |
---|---|
Required |
Replace this variable with the system-defined ID assigned to the desired failover group. Use the Get All Failover Groups endpoint to retrieve a list of failover groups and their system-defined ID. |
Request body parameter:
Pass the following request body parameter:
Name |
Data Type |
Description |
---|---|---|
no_slicer Required |
Boolean |
Determines the source for the failover group's feed. Valid values are:
|
Pass a digital signature based off of msg.
The response for a successful request is a 204 No Content.
Call the toggle_source_feed module (Python 3) to toggle the source of a failover group's feed. This module imports names from the api_auth module.
import json import requests from api_auth import APICredentials, APIParams class FailoverGroup: def __init__(self): self.host = "https://services.uplynk.com" def run(self): self._toggle_source_feed() def _toggle_source_feed(self): failover_group_id = 'e8d6b5cb940c40cc9ec6ad081a38f3f0' # Replace with the ID for the desired failover group. url = "{}{}{}{}".format(self.host, "/api/v4/failover-groups/", failover_group_id, "/set_no_slicer") payload = { 'no_slicer': True } headers = {'Content-Type': 'application/json'} response = requests.put( url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers ) print(response.status_code) FailoverGroup().run()
Updates a failover group's failover mode, automatic failback, or both.
Request syntax:
Request URL variable:
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 |
---|---|
Required |
Replace this variable with the system-defined ID assigned to the desired failover group. Use the Get All Failover Groups endpoint to retrieve a list of failover groups and their system-defined ID. |
Request body parameters:
Pass the following request body parameters:
Name |
Data Type |
Description |
---|---|---|
auto_failback | Boolean |
Determines whether our service will switch back to a higher priority Live Slicer when it resumes a healthy state. Valid values are: True | False
This parameter is only applicable when the failover group uses a prioritized failover mode. |
mode |
String |
Determines how our system chooses which Live Slicer will serve as a source for your live stream. Valid values are:
|
Pass a digital signature based off of msg.
The response for a successful request is a 204 No Content.
Call the update_failover_group_configuration module (Python 3) to update a failover group's failover mode, automatic failback, or both. This module imports names from the api_auth module.
import json import requests from api_auth import APICredentials, APIParams class FailoverGroup: def __init__(self): self.host = "https://services.uplynk.com" def run(self): self._update_failover_group_configuration() def _update_failover_group_configuration(self): failover_group_id = 'e8d6b5cb940c40cc9ec6ad081a38f3f0' # Replace with the ID for the desired failover group. url = "{}{}{}".format(self.host, "/api/v4/failover-groups/", failover_group_id) payload = { 'auto_failback': True, 'mode': 'prioritized' } headers = {'Content-Type': 'application/json'} response = requests.patch( url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers ) print(response.status_code) FailoverGroup().run()
Updates failover eligibility for one or more Live Slicer(s).
Request syntax:
Request URL variable:
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 |
---|---|
Required |
Replace this variable with the system-defined ID assigned to the desired failover group. Use the Get All Failover Groups endpoint to retrieve a list of failover groups and their system-defined ID. |
Request body parameter:
Pass the following request body parameter:
Name |
Data Type |
Description |
---|---|---|
slicers Required |
List of Dictionaries |
Contains the set of Live Slicers whose failover eligibility status will be updated. |
The slicers list updates one or more Live Slicer's failover eligibility via the following properties:
Name |
Data Type |
Description |
---|---|---|
enabled |
Boolean |
Determines whether our system can failover to this Live Slicer. Valid values are:
|
order |
Integer |
Determines the order, starting from 1, in which our system will choose Live Slicers upon failover. Set this property to 1 If the failover group uses flat mode (i.e., random Live Slicer selection). |
slicer_id |
String |
Identifies a Live Slicer by its ID. A Live Slicer's ID is determined by the slicerID setting in its configuration file This property only accepts Live Slicers that already belong to this failover group. All other Live Slicers are ignored. |
Pass a digital signature based off of msg.
The response for a successful request is a 204 No Content.
Call the update_live_slicer_failover_eligibility module (Python 3) to update Live Slicer failover eligibility. This module imports names from the api_auth module.
import json import requests from api_auth import APICredentials, APIParams class FailoverGroup: def __init__(self): self.host = "https://services.uplynk.com" def run(self): self._update_live_slicer_failover_availability() def _update_live_slicer_failover_availability(self): failover_group_id = 'e8d6b5cb940c40cc9ec6ad081a38f3f0' # Replace with the ID for the desired failover group. url = "{}{}{}{}".format(self.host, "/api/v4/failover-groups/", failover_group_id, "/slicers") payload = { 'slicers': [{ 'slicer_id': 'myslicer01', 'order': 1, 'enabled': True }, { 'slicer_id': 'myslicer02', 'order': 2, 'enabled': False }] } headers = {'Content-Type': 'application/json'} response = requests.put( url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers ) print(response.status_code) FailoverGroup().run()