Customer Sign In

upLynk

Integration APIs: Channel

Overview

The channel APIs are for manipulating and querying information on live (linear) channels in your upLynk account.

/api2/channel/get

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

Request parameters
idslist(optional*) a list of IDs corresponding to the channels for which information should be returned
external_idslist(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

Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Call('/api2/channel/get', external_id='id1234')

{
    "test_player_url": "http://content.uplynk.com/player/Hak3zjnPLSW5o0j8GMpzRMsa.html",
    "test_players": [
        {"desc": "Monitoring Test Player",
         "id": "Hak3zjnPLSW5o0j8GMpzRMsa",
         "url": "http://content.uplynk.com/player/Hak3zjnPLSW5o0j8GMpzRMsa.html"},
        {"desc": "Affiliate Test Player",
         "id": "3fqeYp0yrG5Pk4bDqazn79",
         "url": "http://content.uplynk.com/player/3fqeYp0yrG5Pk4bDqazn79sa.html"}],
    "embed_player_url": "http://content.uplynk.com/player/1wEDDmfjafWGeCtDfm5L5s2SD26A1YDRJDy10r7pSCc4EikDu.html",
    "require_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 parameters
idstring(optional*) the ID of the channel to modify
external_idstring(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.
titlestring(optional) A description for the channel
test_player_urlany (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_urlany(optional) Specifying any value for this parameter will cause a new embed player URL to be generated.
slicer_idstring(optional) Set the slicer ID to use for this channel.
slicer_ownerstring(optional) The upLynk Owner ID for the slicer. If not specified, the channel's owner is used.
require_drmint(optional) Specify a 1 to enable required tokens. Specify a 0 to disable required tokens.
slatestring(optional) The id of the asset to use as slate for the channel.
metastring(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)
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Call('/api2/channel/update', id='5915d84829405cb4db1bc3f71c10fc83', test_player_url=1, title='New Title', meta='{"key1":"value1"}')

{
    "test_player_url": "http://content.uplynk.com/player/Hak3zjnPLSW5o0j8GMpzRMsa.html",
    "test_players": [
        {"desc": "Monitoring Test Player",
         "id": "Hak3zjnPLSW5o0j8GMpzRMsa",
         "url": "http://content.uplynk.com/player/Hak3zjnPLSW5o0j8GMpzRMsa.html"},
        {"desc": "Affiliate Test Player",
         "id": "3fqeYp0yrG5Pk4bDqazn79",
         "url": "http://content.uplynk.com/player/3fqeYp0yrG5Pk4bDqazn79sa.html"}],
    "embed_player_url": "http://content.uplynk.com/player/1wEDDmfjafWGeCtDfm5L5s2SD26A1YDRJDy10r7pSCc4EikDu.html",
    "meta": {"key1": "value1"},
    "require_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 ID's are opaque values to the upLynk 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 parameters
desc (or title)string(required) A description for the channel
external_idstring(optional) The external_id for the new channel.
slicer_idstring(optional) The slicer ID to use for the new channel.
slicer_ownerstring(optional) The upLynk Owner ID for the slicer. If not specified, the channel's owner is used.
require_drmint(optional) Specify a 1 to enable required tokens. Specify a 0 to disable required tokens.
slatestring(optional) The id of the asset to use as slate for the channel.
metastring(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)
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Call('/api2/channel/create', title='New Title', slicer_id="my_slicer", meta='{"key1":"value1"}')

{
    "test_player_url": "http://content.uplynk.com/player/Hak3zjnPLSW5o0j8GMpzRMsa.html",
    "test_players": [
        {"desc": "Monitoring Test Player",
         "id": "Hak3zjnPLSW5o0j8GMpzRMsa",
         "url": "http://content.uplynk.com/player/Hak3zjnPLSW5o0j8GMpzRMsa.html"},
        {"desc": "Affiliate Test Player",
         "id": "3fqeYp0yrG5Pk4bDqazn79",
         "url": "http://content.uplynk.com/player/3fqeYp0yrG5Pk4bDqazn79sa.html"}],
    "embed_player_url": "http://content.uplynk.com/player/1wEDDmfjafWGeCtDfm5L5s2SD26A1YDRJDy10r7pSCc4EikDu.html",
	"meta": {"key1": "value1"},
    "require_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 ID's are opaque values to the upLynk 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 parameters
limitinteger(optional) Cap the number of items returned, maximum of 100 items.
skipinteger(optional) Skip the first N results. The skip and limit parameters can be used together for paginated results.
Response parameters
channelslistA list of channels, where each matches the form returned by channel/get.
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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 parameters
idslist(optional*) a list of IDs of channels to be deleted
external_idslist(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

Response parameters
deletedlistA list of channels that were deleted. Each item in the list contains id and external_id members.
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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 parameters
idstring(optional*) the channel's ID
external_idstring(optional*) the channel's external ID
startint(optional**) start of time range to search, in UTC seconds since the epoch
stopint(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.

Example
1
2
3
4
5
6
7
8
9
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 parameters
channelslistA 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_idstring(Optional) The slicer ID to use for the override slicer. If omitted, the override slicer ID is cleared for the specified channels.
override_slicer_ownerstring(Optional) The upLynk Owner ID for the override slicer. If omitted, the channel's owner is used.
Example
1
2
3
4
5
6
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 parameters
idstring(optional*) the channel's ID
external_idstring(optional*) the channel's external ID

* Either id or external_id must be specified.

Example
1
2
3
4
5
6
7
8
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 parameters
idstring(optional*) the channel's ID
external_idstring(optional*) the channel's external ID
schedulelistA 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:

Channel Schedule entry format
typestringOne of "slicer", "asset", "ad", or "empty"
offsetint(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.
startstringyyyy-mm-dd hh:mm:ss formatted UTC start time for this schedule entry
assetstring or list(For asset type entries*) The upLynk asset ID(s) to use
external_idstring or list(For asset type entries*) The external ID(s) of the asset(s) to use (can be "<owner ID>:<external ID>")
slicer_idstring(Required for slicer type entries) The ID of the slicer to use (can be "<owner 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.

Example
1
2
3
4
5
6
7
8
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"}
    ]
}