Channel

This API is only compatible with live channels that do not have scheduling enabled. Use the Live Channel API to manage live channels that have scheduling enabled.

The channel APIs are for manipulating and querying information on your live linear channels.

/api2/channel/get

Retrieves information about a specific channel or channels in your account.

Request Parameter

Type

Description

ids

list

(optional*) a list of IDs corresponding to the channels for which information should be returned

external_ids

list

(optional*) a list of external IDs corresponding to the channels for which information should be returned

* Either ids or external_ids must be specified, and both are allowed.

The singular for each parameter works, as well, if given a string with just one id

Sample request/response:

The Call() function, which is imported from uplynk_api2_auth module, prepares the message body and digital signature.

from uplynk_api2_auth import Call

print(Call('/api2/channel/get', external_id='id1234'))

{
    "test_player_url": "https://content.uplynk.com/player5/Hak3zjnPLSW5o0j8GMpzRMsa.html",
    "test_players": [
        {"desc": "Monitoring Test Player",
         "id": "Hak3zjnPLSW5o0j8GMpzRMsa",
         "url": "https://content.uplynk.com/player5/Hak3zjnPLSW5o0j8GMpzRMsa.html"},
        {"desc": "Affiliate Test Player",
         "id": "3fqeYp0yrG5Pk4bDqazn79",
         "url": "https://content.uplynk.com/player5/3fqeYp0yrG5Pk4bDqazn79sa.html"}],
    "embed_player_url": "https://content.uplynk.com/player5/1wEDDmfjafWGeCtDfm5L5s2SD26A1YDRJDy10r7pSCc4EikDu.html",
    "require_drm": 1,
    "require_studio_drm": 1,
    "slicer_id": "slicer1234",
    "slicer_owner": "ea8b4debcf0d438ea44a34e0febf8a50",
    "title": "Live test channel",
    "live_delay": 10,
    "has_slicer": false,
    "created": 1318976590877,
    "id": "5915d84829405cb4db1bc3f71c10fc83",
    "deleted": 0,
    "embed_domains": "",
    "thumb_url": "",
    "external_id": "test_chan",
    "asset_autoexpire_hours": 24
}

/api2/channel/update

Modifies a channel.

Request Parameter

Type

Description

id

string

(optional*) the ID of the channel to modify

external_id

string

(optional*) A new external_id for the channel. Note: if you retrieved the channel by external ID, you cannot also update the external ID at the same time.

title

string

(optional) A description for the channel

test_player_url

any

(optional) Specifying any value for this parameter will cause a new test player URL to be generated. Note that this does not expire any existing test players; it adds a new test player to the list of test players. To expire a test player please use the CMS web interface.

embed_player_url

any

(optional) Specifying any value for this parameter will cause a new embed player URL to be generated.

slicer_id

string

(optional) Set the slicer ID to use for this channel.

slicer_owner

string

(optional) The slicer's user ID. If not specified, the channel's owner is used.

require_drm

int

(optional) Specify a 1 to enable required tokens. Specify a 0 to disable required tokens.

require_studio_drm

int

(optional) Specify a 1 to require Studio DRM. Specify a 0 to disable Studio DRM.

slate

string

(optional) The id of the asset to use as slate for the channel.

meta

string

(optional) The metadata to set on the channel. This must be a dictionary in JSON format. If the channel has existing meta, any new meta will be merged. To clear all metadata, set to '{}'.

* Either id or external_id must be specified.

Response: Same as for channel/get

Sample request/response:

The Call() function, which is imported from uplynk_api2_auth module, prepares the message body and digital signature.

from uplynk_api2_auth import Call

print(Call('/api2/channel/update', id='5915d84829405cb4db1bc3f71c10fc83', test_player_url=1, title='New Title', meta='{"key1":"value1"}'))

{
    "test_player_url": "https://content.uplynk.com/player5/Hak3zjnPLSW5o0j8GMpzRMsa.html",
    "test_players": [
        {"desc": "Monitoring Test Player",
         "id": "Hak3zjnPLSW5o0j8GMpzRMsa",
         "url": "https://content.uplynk.com/player5/Hak3zjnPLSW5o0j8GMpzRMsa.html"},
        {"desc": "Affiliate Test Player",
         "id": "3fqeYp0yrG5Pk4bDqazn79",
         "url": "https://content.uplynk.com/player5/3fqeYp0yrG5Pk4bDqazn79sa.html"}],
    "embed_player_url": "https://content.uplynk.com/player5/1wEDDmfjafWGeCtDfm5L5s2SD26A1YDRJDy10r7pSCc4EikDu.html",
    "meta": {"key1": "value1"},
    "require_drm": 1,
    "require_studio_drm": 1,
    "slicer_id": "slicer1234",
    "slicer_owner": "ea8b4debcf0d438ea44a34e0febf8a50",
    "title": "New Title",
    "live_delay": 10,
    "has_slicer": false,
    "created": 1318976590877,
    "id": "5915d84829405cb4db1bc3f71c10fc83",
    "deleted": 0,
    "embed_domains": "",
    "thumb_url": "",
    "external_id": "test_chan",
    "asset_autoexpire_hours": 24
}

Note that external IDs are opaque values to our system so it is up to you to use a convention that ensures uniqueness within your account. If you assign the same external ID to multiple channels, the system will choose one arbitrarily when you try to access the channel by its external ID.

/api2/channel/create

Creates a new channel

Request Parameter

Type

Description

desc

string

(required) A description for the channel

external_id

string

(optional) The external_id for the new channel.

slicer_id

string

(optional) The slicer ID to use for the new channel.

slicer_owner

string

(optional) The slicer's user ID. If not specified, the channel's owner is used.

require_drm

int

(optional) Specify a 1 to enable required tokens. Specify a 0 to disable required tokens.

require_studio_drm

int

(optional) Specify a 1 to require Studio DRM. Specify a 0 to disable Studio DRM.

slate

string

(optional) The id of the asset to use as slate for the channel.

meta

string

(optional) The metadata to set on the channel. This must be a dictionary in JSON format.

* Either id or external_id must be specified.

Response: Same as for channel/get

Sample request/response:

The Call() function, which is imported from uplynk_api2_auth module, prepares the message body and digital signature.

from uplynk_api2_auth import Call

print(Call('/api2/channel/create', title='New Title', slicer_id="my_slicer", meta='{"key1":"value1"}'))

{
    "test_player_url": "https://content.uplynk.com/player5/Hak3zjnPLSW5o0j8GMpzRMsa.html",
    "test_players": [
        {"desc": "Monitoring Test Player",
         "id": "Hak3zjnPLSW5o0j8GMpzRMsa",
         "url": "https://content.uplynk.com/player5/Hak3zjnPLSW5o0j8GMpzRMsa.html"},
        {"desc": "Affiliate Test Player",
         "id": "3fqeYp0yrG5Pk4bDqazn79",
         "url": "https://content.uplynk.com/player5/3fqeYp0yrG5Pk4bDqazn79sa.html"}],
    "embed_player_url": "https://content.uplynk.com/player5/1wEDDmfjafWGeCtDfm5L5s2SD26A1YDRJDy10r7pSCc4EikDu.html",
	"meta": {"key1": "value1"},
    "require_drm": 1,
    "require_studio_drm": 1,
    "slicer_id": "my_slicer",
    "slicer_owner": "ea8b4debcf0d438ea44a34e0febf8a50",
    "title": "New Title",
    "live_delay": 10,
    "has_slicer": false,
    "created": 1318976590877,
    "id": "5915d84829405cb4db1bc3f71c10fc83",
    "deleted": 0,
    "embed_domains": "",
    "thumb_url": "",
    "external_id": "test_chan",
    "asset_autoexpire_hours": 24
}

Note that external IDs are opaque values to our system so it is up to you to use a convention that ensures uniqueness within your account. If you assign the same external ID to multiple channels, the system will choose one arbitrarily when you try to access the channel by its external ID.

/api2/channel/list

Lists or searches for channels in your account.

Request Parameter

Type

Description

limit

integer

(optional) Cap the number of items returned, maximum of 100 items.

skip

integer

(optional) Skip the first N results. The skip and limit parameters can be used together for paginated results.

 

Response Parameter

Type

Description

channels

list

A list of channels, where each matches the form returned by channel/get.

Sample request/response:

The Call() function, which is imported from uplynk_api2_auth module, prepares the message body and digital signature.

from uplynk_api2_auth import Call

print(Call('/api2/channel/list'))

{
     "channels": [
            {
                "title": "Live test dave 2",
                "id": "7a35c56ea4014856bc74c0a375236cc5",
                "external_id": "bif",
                ...
            }
            {
                "title": "audio-only live test",
                "id": "c9f7f12f44abdfd48e2bb1a326877cd9",
                "external_id": "",
                ...
            }
     ],
     "error": 0
}

/api2/channel/delete

Deletes one or more channels from your library.

Request Parameter

Type

Description

ids

list

(optional*) a list of IDs of channels to be deleted

external_ids

list

(optional*) a list of external IDs of channels to be deleted

* Either ids or external_ids must be specified, and both are allowed.

The singular for each parameter works, as well, if given a string with just one id.

Request Parameter

Type

Description

deleted

list

A list of channels that were deleted. Each item in the list contains id and external_id members.

Sample request/response:

The Call() function, which is imported from uplynk_api2_auth module, prepares the message body and digital signature.

from uplynk_api2_auth import Call

print(Call('/api2/channel/delete', ids=['0a671113bebb4192bf679db9ee146051'],
                                                external_ids=['channel1', 'channel2']))

{
    "deleted": [
        {
            "external_id": "",
            "id": "0a671113bebb4192bf679db9ee146051"
        },
        {
            "external_id": "channel1",
            "id": "54e40044a5f84050a483a5ce91cedab1"
        },
        {
            "external_id": "channel2",
            "id": "9c4e00aab263489aa7fd275a0c5cc478"
        }
    ],
    "error": 0
}

/api2/channel/assets

Lists assets for a live channel.

Request Parameter

Type

Description

id

string

(optional*) the channel's ID

external_id

string

(optional*) the channel's external ID

start

int

(optional**) start of time range to search, in UTC seconds since the epoch

stop

int

(optional**) end of time range to search, in UTC seconds since the epoch

* Either id or external_id must be specified.

** If start/stop are not provided, returns assets in a time range from 8 hours ago until now. Omitting either start or stop is the same as omitting both.

Sample request/response:

The Call() function, which is imported from uplynk_api2_auth module, prepares the message body and digital signature.

from uplynk_api2_auth import Call

print(Call('/api2/channel/assets', external_id='id1234'))

{
    "assets": [
        "796583f9cb6d4a15b4a1953875c016ba",
        "1771b649430ff421ac230efce46639e8"
    ],
    "error": 0
}

/api2/channel/override

Sets or clears the override slicer ID for one or more live channels.

Request Parameter

Type

Description

channels

list

A list of objects specifying channel IDs or external IDs. Each object can also include an override_slicer_id and override_slicer_owner to use in place of the global values.

override_slicer_id

string

(Optional) The slicer ID to use for the override slicer. If omitted, the override slicer ID is cleared for the specified channels.

override_slicer_owner

string

(Optional) The override slicer's user ID. If omitted, the channel's owner is used.

Sample request/response:

The Call() function, which is imported from uplynk_api2_auth module, prepares the message body and digital signature.

from uplynk_api2_auth import Call

print(Call('/api2/channel/override', channels=[{'external_id':'id1234'}, {'id':'7a35c56ea4014856bc74c0a375236cc5'}], override_slicer_id='other_slicer'))

{
    "updated": 2,
    "error": 0
}

/api2/channel/schedule/get

Returns the current channel schedule for the specified channel.

Request Parameter

Type

Description

id

string

(optional*) the channel's ID

external_id

string

(optional*) the channel's external ID

* Either id or external_id must be specified.

Sample request/response:

The Call() function, which is imported from uplynk_api2_auth module, prepares the message body and digital signature.

from uplynk_api2_auth import Call

print(Call('/api2/channel/schedule/get', id='9b1b11bfc1633c719445f17acdbb1300'))

{
    "error": 0,
    "schedule": [
        {"slicer_owner": "a7f00f7e324b4946cf2accb9b6fe6b49", "start": "2013-04-18 22:55:08", "offset": 0, "type": "slicer", "slicer_id": "slicer123"}
    ]
}

/api2/channel/schedule/update

Updates the channel schedule for the specified channel, overwriting existing entries

Request Parameter

Type

Description

id

string

(optional*) the channel's ID

external_id

string

(optional*) the channel's external ID

schedule

list

A list of schedule entries to replace the current schedule. Entries should appear in the list in order.

* Either id or external_id must be specified.

schedule is a list of objects with the following attributes:

Parameter

Type

Description

type

string

One of "slicer", "asset", "ad", or "empty"

offset

int

(Optional) For assets, indicates how many seconds into the asset playback should begin. For slicers, indicates how many seconds in the past to start playback.

start

string

yyyy-mm-dd hh:mm:ss formatted UTC start time for this schedule entry

asset

string or list

(For asset type entries*) The asset ID(s) to use

external_id

string or list

(For asset type entries*) The external ID(s) of the asset(s) to use (can be "<user ID>:<external ID>")

slicer_id

string

(Required for slicer type entries) The ID of the slicer to use (can be "<user ID>:<slicer ID>")

* Either asset or external_id must be specified for asset type entries.

asset type entries may specify a list containing multiple assets. These entries will be split into multiple schedule entries, with extra duration being distributed among them.

Sample request/response:

The Call() function, which is imported from uplynk_api2_auth module, prepares the message body and digital signature.

from uplynk_api2_auth import Call

print(Call('/api2/channel/schedule/update', id='9b1b11bfc1633c719445f17acdbb1300', schedule=[{"type":"asset", "external_id":"abc123", "start": "2013-04-18 22:55:08"}]))

{
    "error": 0,
    "schedule": [
        {"start": "2013-04-18 22:55:08", "offset": 0, "type": "asset", "asset": "292b537f6c04400192bde0225679b8c8"}
    ]
}