Skip to main content
Skip table of contents

Retrieve all or part of the rails and related content for a template

Description

This API returns all the rails from the requested template, and will retrieve the related data for each section of the rail from the specified locations, e.g., nodes, recommendation engines, etc.

It incorporates paging, so you do can just retrieve the content that you need, which means a smaller response payload and a faster response time.

Request

To retrieve the rails for a particular template, send a GET request to:

CODE
https://server:port/contentdelivery/v1/templateviews/{templateid|templatename}

Preconditions

The operator should have created the templates and their layouts. They also need to schedule templates for the current time to be able to retrieve this list. If a template doesn’t have a scheduled layout for the current time the API won’t be able to retrieve it.

To be able to see contents it is required that at least one rail has been added to a layout and at least one rail item has been added to the rail.

Headers

  • Authorization: Bearer – bearer token

  • Content-Type: application/json

  • Nagra-Target – the device type (e.g., TV)

  • Accept-Language – the locale (e.g., en_GB)

Mandatory arguments

  • {templateid|templatename} – the client must pass either a template ID or a template name (both are unique) to retrieve the specific template’s rails and their content (in URL).

Optional arguments

The following optional arguments (all in the query part of the URL) allow you to request just the parts of the rails/content that you require:

  • vLimit – the number of rails to return (default: all rails)

  • vOffset – the index of the first rail to return (default: 0)

  • vPage – the index of the page to be returned (where the page size is defined by the specified vLimit) (default: 0)

  • limit – the number of contents to return per rail (default: 10 unless configured differently)

For example, to return the first 10 rails, use the following query:

CODE
?vLimit=10

To return the second group of 10 rails, use the following query:

CODE
?vLimit=10&vPage=2

Alternatively, you can use the following query to achieve the same result:

CODE
?vlimit=10&vOffset=10

Response

A successful request returns an HTTP 200 status. The response includes a list of templates and the number of templates.

An unsuccessful request returns an HTTP 500 status if there was a problem with the request.

Example

JSON
{
  "name": "westerns",
  "title": "Yee Haw!",
  "properties": {
    "background-image": "/IM/cowboy_background.jpg"
  },
  "targets": [
    "ios",
    "Android"
  ],
  "rails": [
    {
      "name": "best",
      "title": "Best of Westerns",
      "layout": "landscape",
      "properties": {
        "play-trailers-on-hover": "true"
      },
      "sections": [
        {
          "type": "ContentItem",
          "properties": {
            "size": "promoted"
          },
          "content": [
            {
              "type": "editorial",
              "id": "GLOBAL_gbu",
              "Title": "The Good, the Bad and the Ugly"
            }
          ]
        },
        {
          "type": "NodeItem",
          "properties": {
            "size": "standard"
          },
          "content": [
            {
              "type": "editorial",
              "id": "GLOBAL_ffd",
              "Title": "A Fistful of Dollars"
            },
            {
              "type": "editorial",
              "id": "GLOBAL_ffdm",
              "Title": "For a Few Dollars More"
            },
            {
              "type": "editorial",
              "id": "GLOBAL_u",
              "Title": "The Unforgiven"
            },
            {
              "type": "editorial",
              "id": "GLOBAL_ncfom",
              "Title": "No Country for Old Men"
            }
          ]
        },
        {
          "type": "PreCuratedItem",
          "properties": {
            "size": "jumbo"
          },
          "source": "AMCO",
          "content": [
            {
              "type": "editorial",
              "id": "GLOBAL_tc",
              "Title": "Thundercats",
              "images": [
                {
                  "name": "medium_16_9",
                  "aspectRatio": "16:9",
                  "height": 480,
                  "width": 720,
                  "uri": "https://m.media-amazon.com/images/M/MV5BMjJhNjMzNzYtMzIwYy00OGQ5LWE0NWMtNWJkNWE3NmMwNDJkL2ltYWdlL2ltYWdlXkEyXkFqcGdeQXVyNDUxNjc5NjY@._V1_.jpg"
                }
              ],
              "links": [
                {
                  "provider": "AMCO",
                  "type": "vod",
                  "action": "direct",
                  "uri": "https://amco.com/thundercats_ho!"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

See also

For full details of this API, see the Content Delivery API documentation.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.