{"id":805,"date":"2017-08-16T20:19:41","date_gmt":"2017-08-16T20:19:41","guid":{"rendered":"http:\/\/live.ecd-demo.com\/apihelp\/?page_id=805"},"modified":"2017-08-16T20:19:41","modified_gmt":"2017-08-16T20:19:41","slug":"contexts","status":"publish","type":"page","link":"https:\/\/apihelp.ecd-demo.com\/index.php\/documentation\/what-does-the-api-contain\/contexts\/","title":{"rendered":"Contexts"},"content":{"rendered":"<h3>ABOUT CONTEXTS<\/h3>\n<hr>\n<p>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.<\/p>\n<h4>ALL CONTEXTS<\/h4>\n<pre><code class=\"swift\">GET  http:\/\/&lt;api-domain&gt;\/contexts\/filter?count=5&amp;startAfter=0\n<\/code><\/pre>\n<h5>Parameters:<\/h5>\n<p><strong><code>count<\/code><\/strong>: <em>(optional)<\/em> Number of annotation templates to return, used together with startAfter for pagination of the response.<br \/>\n<strong><code>startAfter<\/code><\/strong>: <em>(optional)<\/em> ID of the last annotation template of the previous page. Note that annotation templates are stored in a random but deterministic order.<\/p>\n<h5>Response:<\/h5>\n<pre><code class=\"json\">    {\n        \"contextId\": \"CA-fr-context\",\n        \"numberOfResults\": 20,\n        \"filter\": {\n            \"operator\": \"and\",\n            \"criteria\": [\n                {\n                    \"term\": \"images\",\n                    \"operator\": \"exists\"\n                },\n                {\n                    \"term\": \"searchableTitles.value.fr\",\n                    \"operator\": \"exists\"\n                },\n                {\n                    \"term\": \"sourceId\",\n                    \"values\": [\n                        \"45014\",\n                        \"725\",\n                        \"45010\",\n                        \"45459\",\n                        \"45013\",\n                        \"33006\",\n                        \"47760\"\n                    ],\n                    \"operator\": \"in\"\n                },\n                {\n                    \"term\": \"eventType\",\n                    \"values\": [\n                        \"vod\",\n                        \"linear\"\n                    ],\n                    \"operator\": \"in\"\n                }\n            ]\n        },\n        \"annotationIds\": [\n            \"gd-event-generic-carousel\",\n            \"gd-event-new-available-tv-carousel-addon\"\n        ],\n        \"sorting\": [\n            {\n                \"criterion\": \"originalAiringDateTime\",\n                \"direction\": \"descending\"\n            },\n            {\n                \"criterion\": \"yearOfProduction\",\n                \"direction\": \"descending\"\n            }\n        ]\n    }\n<\/code><\/pre>\n<hr>\n<h3>CONTEXT TEMPLATES<\/h3>\n<h4>GET<\/h4>\n<p>Retrieves an context template which can be used to retrieve list based on rules defined.<\/p>\n<pre><code class=\"swift\">GET http:\/\/&lt;api-domain&gt;\/contexts\/filter\/&lt;contextId&gt;\n<\/code><\/pre>\n<h5>RESPONSE:<\/h5>\n<pre><code class=\"json\">{\n    \"contextId\": \"CA-fr-context\",\n    \"numberOfResults\": 20,\n    \"filter\": {\n        \"operator\": \"and\",\n        \"criteria\": [\n            {\n                \"term\": \"images\",\n                \"operator\": \"exists\"\n            },\n            {\n                \"term\": \"searchableTitles.value.fr\",\n                \"operator\": \"exists\"\n            },\n            {\n                \"term\": \"sourceId\",\n                \"values\": [\n                    \"45014\",\n                    \"725\",\n                    \"45010\",\n                    \"45459\",\n                    \"45013\",\n                    \"33006\",\n                    \"47760\"\n                ],\n                \"operator\": \"in\"\n            },\n            {\n                \"term\": \"eventType\",\n                \"values\": [\n                    \"vod\",\n                    \"linear\"\n                ],\n                \"operator\": \"in\"\n            }\n        ]\n    },\n    \"annotationIds\": [\n        \"gd-event-generic-carousel\",\n        \"gd-event-new-available-tv-carousel-addon\"\n    ],\n    \"sorting\": [\n        {\n            \"criterion\": \"originalAiringDateTime\",\n            \"direction\": \"descending\"\n        },\n        {\n            \"criterion\": \"yearOfProduction\",\n            \"direction\": \"descending\"\n        }\n    ]\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":66,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-805","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/apihelp.ecd-demo.com\/index.php\/wp-json\/wp\/v2\/pages\/805","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/apihelp.ecd-demo.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/apihelp.ecd-demo.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/apihelp.ecd-demo.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apihelp.ecd-demo.com\/index.php\/wp-json\/wp\/v2\/comments?post=805"}],"version-history":[{"count":0,"href":"https:\/\/apihelp.ecd-demo.com\/index.php\/wp-json\/wp\/v2\/pages\/805\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/apihelp.ecd-demo.com\/index.php\/wp-json\/wp\/v2\/pages\/66"}],"wp:attachment":[{"href":"https:\/\/apihelp.ecd-demo.com\/index.php\/wp-json\/wp\/v2\/media?parent=805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}