Rails use cases
Typically, a client application will need to make several calls to get all the information it needs to render the different pages that make up its interface and the rails within each page, as shown in the following diagram:
The calls that the client makes are as follows:
Retrieve the template hierarchy – call
GET https://<host>:<port>/contentdelivery/v1/templateviews/hierarchyto get the hierarchy of templates that represent the various screens.Retrieve the rail structure for a template – for each page/template, call
GET https://<host>:<port>/contentdelivery/v1/templatesummary/{templateId}to get the rails that make up the page (without their contents).Retrieve a specific rail and its contents – for each rail on the page, call
GET https://<host>:<port>/contentdelivery/v2/templateviews/{templateId}/rails/{railId}?limit=10to get the rail contents and metadata.
Make sure you follow Rails best practices:Load only enough rails to populate the visible part of the screen, plus enough additional rails so that the user does not have to wait for rails to load when they scroll vertically. Load any additional rails only as needed when the user scrolls.
Within each rail, load only enough rail items to fill the visible part of the rail and the first part that the user will see if they scroll horizontally, and only load more if they do scroll. (Use the
limit,page, andoffsetparameters to do this.)
When the client displays a rail on the screen, it must report a
railViewevent. As the user scrolls vertically and the client displays more rails, it must reportrailViewfor each new rail that it displays.
See Reporting activity and event metrics to UAV and Rails-specific metrics.When the user clicks on an item in a rail, the client needs to:
Report a
railSelectionevent. See Rails-specific metrics.Perform the appropriate action. This depends on the type of item the user clicks on.
See Section types in Interpreting rails responses.
When you make a request to Content Delivery, you must include:
The destination (e.g.,
tvormobile) in theNagra-Targetheader. Content Delivery returns the appropriate layout for that destination.The device type (e.g.,
AndroidoriOS) in theNagra-Device-Typeheader. This ensures that the rails that Content Delivery returns reference the correct technical contents (e.g., an HLS technical for iOS or a DASH technical for Android).
Search
A client application can also use rails for searching. If a search template has been set up in OpCon (see Set up a search template), the client can send a request to Content Delivery that includes search criteria.
The response will consist of a template with a rail that contains the search results, which the client can display in exactly the same way as any other rail.
