Retrieving channel lists
Request
Lists of channels can be retrieved using the MDS Services API.
To retrieve a list of channels, send a GET request to:
https://<host>:<port>/metadata/delivery/<provider>/btv/services
Headers
Authorization: Bearer
– bearer tokenContent-Type: application/json
Mandatory arguments
provider
- Narrows down queries to a single service provider to allow for API clarity and security.
Other arguments
All these arguments are query parameters:
filter
- A list of key/value pairs, where key is the fieldname and value is the value the field should be.sort
- A list of pairs, where a pair is a list containing a field name and a sort order with 1 ascending, and -1 is descending.fields
- A list of fields names to return in the response.offset
- The number of records to skip for pagination.limit
- The number of records to return for pagination.cache
- Sets or unsets HTTP headers; TRUE allows CDN caching, FALSE prevents CDN caching.pretty
- TRUE returns human-readable formatted JSON, FALSE returns compact and efficient JSON.
Response
A successful request returns an HTTP 200 status.
A bad request returns an HTTP 400 status.
An unsuccessful request returns an HTTP 401 status.
Examples
Retrieving all channels
All channels can be retrieved by not specifying a channel filter, for example:
https://<host>:<port>/metadata/delivery/<provider>/btv/services?filter={"locale":"en_gb"}&sort=[["Title",1]]&fields=["Title", "tvChannel"]&offset=0&limit=10
This will request the list of all channels with an "en_gb"
locale, ordered by Title
, with only the Title
and tvChannel
(channel number) field returned.
A locale
must be specified to retrieve the data in that language; the system default will be used if no locale
is specified.
Only the first ten channels will be returned due to the limit
; the next ten can be specified by specifying offset=10&limit=10
.
Retrieving subscribed channels
The broadcast subscription products applicable for the account is retrieved, the product identifiers are collated into an array and passed as a productRefs
filter.
https://<host>:<port>/metadata/delivery/<provider>/btv/services?filter={"locale":"en_gb","technical.productRefs":{"$in":["LYS007270748"]}}&sort=[["Title",1]]&fields=["Title","tvChannel"]&offset=0&limit=10
An example response would be:
{
"services": [
{
"editorial" : {
"Title": "BBC One Wales HD",
"tvChannel": "169"
"id": "LJDLSADJASD21"
},
"technical": {
"id": "SIUOIDFJLS8237892374",
}
}
],
"total_records": 30,
"version" : 201301011500
}
See also
For full details of this API, see Metadata Server (MDS) API Documentation.