Retrieves one or more rules.
Request
GET /rules?page=Page Number&page_size=Items Per Page
Request query string parameters:
Pass the following request query string parameters:
Name | Description |
---|---|
page=Page Number | Filter the response by a specific page. Replace this variable with the desired page. Use the navigation links within the @links object to navigate between pages. Default Value: 1 |
page_size=Items Per Page | Sets the number of rule configurations that may be included on each page. The number of items per page determines the number of pages that may be returned. The maximum page size is 40. Default value: 40 |
Response
A successful request returns a 200 OK response that contains the following properties:
Name | Data Type | Description |
---|---|---|
@id | String | Indicates the relative path to the requested endpoint. |
@type | String | Returns Collection. |
items | List of dictionaries | Contains a list of rule configurations. |
total_items | Integer | Indicates the total number of rule configurations. |
items List
The items list describes each rule configuration via the following properties:
Name | Data Type | Description | |||
---|---|---|---|---|---|
@id | String | Indicates the relative path to an endpoint that returns this rule. | |||
@type | String | Returns Rule. | |||
all_viewers | Boolean | Indicates whether this rule applies to all audiences. Default value: False | |||
alternate_content_id | String | Indicates the alternate content that will be streamed to blacked out viewers by its ID. The alternate_content_type parameter determines the type of ID defined within this parameter. alternate_content_type: asset Asset ID alternate_content_type: channel Live Channel ID alternate_content_type: slicer Live Slicer ID alternate_content_type: slate Conditional blackout slate will be streamed to blacked out viewers. This parameter should be an empty value. | |||
alternate_content_loop | Boolean | Indicates whether alternate content will be looped. Valid values are: True | False | ||
alternate_content_type | String | Indicates the type of alternate content that will be streamed to blacked out viewers. Valid case-sensitive values are: asset | channel | slate | slicer Identify alternate content through both the alternate_content_id and the alternate_content_type parameters. For example, specify a CMS asset by setting the alternate_content_type parameter to asset and the alternate_content_id parameter to the desired asset ID. |
audience | String | all_viewers: false Indicates an audience or superaudience by its system-defined ID. This rule will only be applied to the specified audience when the all_viewers parameter is set to False. | |||
created | String | Indicates the timestamp (UTC) at which the rule was created. Syntax (ISO 8601): YYYY-MM-DDThh:mm:ss.sssZ | |||
desc | String | Indicates the name of the rule. | |||
external_id | String | Indicates the external ID associated with this rule. | |||
id | String | Identifies this rule by its system-defined ID. | |||
owner | String | Indicates the system-defined ID for the user that owns this rule. |
Sample Request/Response
Call the get_multiple_rules module (Python 3) to retrieve multiple rules. This module imports names from the api_auth module.
import json, requests
from api_auth import APICredentials, APIParams
class Rule:
def __init__(self):
self.host = "https://services.uplynk.com"
def run(self):
self._get_multiple_rules()
def _get_multiple_rules(self):
url = "{}{}".format(self.host, "/api/v4/rules")
headers = {'Content-Type': 'application/json'}
response = requests.get(
url, params=APIParams(APICredentials()).get_params({}), headers=headers
)
print(response.json())
Rule().run()
Response:
{
'@id': '/api/v4/rules',
'@type': 'Collection',
'items': [{
'@id': '/api/v4/rules/abce337d51f04b6da043cc7f28c9fe2f',
'@type': 'Rule',
'id': 'abce337d51f04b6da043cc7f28c9fe2f',
'created': '2021-07-01T20:45:59.171Z',
'owner': 'abc123def456ghi789jkl012mno345pq',
'external_id': '',
'audience': 'e1fa7c93edda4541937899ad032b9051',
'alternate_content_type': 'slate',
'alternate_content_id': '',
'alternate_content_loop': True,
'all_viewers': False,
'desc': 'audiences'
}, {
'@id': '/api/v4/rules/72511122bf2541728641aefe7b4e58fe',
'@type': 'Rule',
'id': '72511122bf2541728641aefe7b4e58fe',
'created': '2021-07-01T20:30:04.122Z',
'owner': 'abc123def456ghi789jkl012mno345pq',
'external_id': '',
'audience': '',
'alternate_content_type': 'slicer',
'alternate_content_id': 'slicer1',
'alternate_content_loop': False,
'all_viewers': True,
'desc': 'allviewersslicer'
}
],
'total_items': 2
}