Add/Remove Live Channels

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

Request syntax:

PUT /failover-groups/Failover Group ID/channels

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
Failover Group ID RequiredReplace 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:

NameData TypeDescription
channels_ids_to_addList of String ValuesContains 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_removeList of String ValuesContains a list of the live channels that will be removed from the failover group. Identify each desired live channel by its system-defined ID.

Response

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.

Sample Request/Response

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()