Contexts

ABOUT CONTEXTS


Contexts can be predefined and referenced in the request by a context ID, or can be provided as body of the request, called an Ad-hoc Context. A combination of predefined and ad-hoc Contexts is supported, too. Context Management allows creating, retrieving, updating and deleting pre-defined Contexts. Each Context is identified by its unique Context ID.

ALL CONTEXTS

GET  http://<api-domain>/contexts/filter?count=5&startAfter=0
Parameters:

count: (optional) Number of annotation templates to return, used together with startAfter for pagination of the response.
startAfter: (optional) ID of the last annotation template of the previous page. Note that annotation templates are stored in a random but deterministic order.

Response:
    {
        "contextId": "CA-fr-context",
        "numberOfResults": 20,
        "filter": {
            "operator": "and",
            "criteria": [
                {
                    "term": "images",
                    "operator": "exists"
                },
                {
                    "term": "searchableTitles.value.fr",
                    "operator": "exists"
                },
                {
                    "term": "sourceId",
                    "values": [
                        "45014",
                        "725",
                        "45010",
                        "45459",
                        "45013",
                        "33006",
                        "47760"
                    ],
                    "operator": "in"
                },
                {
                    "term": "eventType",
                    "values": [
                        "vod",
                        "linear"
                    ],
                    "operator": "in"
                }
            ]
        },
        "annotationIds": [
            "gd-event-generic-carousel",
            "gd-event-new-available-tv-carousel-addon"
        ],
        "sorting": [
            {
                "criterion": "originalAiringDateTime",
                "direction": "descending"
            },
            {
                "criterion": "yearOfProduction",
                "direction": "descending"
            }
        ]
    }

CONTEXT TEMPLATES

GET

Retrieves an context template which can be used to retrieve list based on rules defined.

GET http://<api-domain>/contexts/filter/<contextId>
RESPONSE:
{
    "contextId": "CA-fr-context",
    "numberOfResults": 20,
    "filter": {
        "operator": "and",
        "criteria": [
            {
                "term": "images",
                "operator": "exists"
            },
            {
                "term": "searchableTitles.value.fr",
                "operator": "exists"
            },
            {
                "term": "sourceId",
                "values": [
                    "45014",
                    "725",
                    "45010",
                    "45459",
                    "45013",
                    "33006",
                    "47760"
                ],
                "operator": "in"
            },
            {
                "term": "eventType",
                "values": [
                    "vod",
                    "linear"
                ],
                "operator": "in"
            }
        ]
    },
    "annotationIds": [
        "gd-event-generic-carousel",
        "gd-event-new-available-tv-carousel-addon"
    ],
    "sorting": [
        {
            "criterion": "originalAiringDateTime",
            "direction": "descending"
        },
        {
            "criterion": "yearOfProduction",
            "direction": "descending"
        }
    ]
}