Searching using search rails
Description
You can set up a rails template specifically for search results (see Creating a search template). A client application can perform a search by sending a request to Content Builder, which will return a rails template populated with the search results.
The app can display it in the same way that it displays any other rails template. This means that you can use the same code and do not need different, specific code for displaying search results.
Request
To search using a particular search template, send a GET request to:
https://server:port/contentdelivery/v2/templateviews/{templateid/templatename}?q="<query>"
Preconditions
The operator should have created the search template. See Creating a search template.
The template name or ID used in this request is the one specified during template creation.
Headers
Authorization: Bearer
– bearer tokenContent-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)"<query>"
– the search query term(s). For example,"Sylvester%20Stallone"
or"Adventure%20Time"
.
Response
A successful request returns an HTTP 200 status. The response includes the contents of the specified template, populated with the search results.
An unsuccessful request returns an HTTP 500 status if there was a problem with the request.
Example
{
"name": "First Rail",
"title": "Home",
"layout": "portrait",
"properties": {
"secret": "sssshh!"
},
"sections": [
{
"type": "ContentItem",
"properties": {
"secret": "sssshh!"
},
"source": "string",
"contents": [
{
"type": "editorial",
"id": "GLOBAL_star_wars",
"title": "Star Wars",
"Actors": [
"Harrison Ford"
],
"rating": {
"code": "string",
"precedence": "string",
"title": "string"
},
"ratings": [
{
"code": "string",
"precedence": "string",
"title": "string"
}
],
"duration": 120,
"description": "Space action",
"synopsis": "Space action",
"categories": [
"Space",
"Action"
],
"seriesRef": "string",
"tmsId": "GLOBAL_star_wars",
"contentType": "movie",
"seasonNumber": 0,
"episodeNumber": 0,
"episode": 0,
"year": 0,
"images": [
{
"name": "small_16_9",
"aspectRatio": "string",
"height": 0,
"width": 0,
"uri": "string",
"hints": [
"string"
]
}
],
"technicals": [
{
"id": "string",
"isSTCU": true,
"isLTCU": true,
"media": {
"AV_PlaylistName": {
"frameDuration": 0,
"format": "string",
"id": "string",
"fileName": "string"
}
},
"deviceType": "string",
"promoImages": [
"string"
],
"prducts": {
"id": "string",
"startPurchase": "string",
"endValidity": "string",
"startValidity": "string",
"rentalDuration": 0,
"price": {
"startPurchase": 0,
"endPurchase": "string",
"currency": "string",
"value": 0
},
"platformRef": "string",
"endPurchase": 0,
"impulsive": true,
"regions": [
"string"
],
"title": "string",
"type": "string"
}
}
],
"links": [
{
"provider": "Netflix",
"type": "string",
"action": "string",
"url": "https://netflix.com/abc/xyz"
}
]
},
{
"type": "programme",
"editorial": {
"type": "editorial",
"id": "GLOBAL_star_wars",
"title": "Star Wars",
"Title": "Star Wars",
"Actors": [
"Harrison Ford"
],
"rating": {
"code": "string",
"precedence": "string",
"title": "string"
},
"ratings": [
{
"code": "string",
"precedence": "string",
"title": "string"
}
],
"duration": 120,
"Description": "Space action",
"Synopsis": "Space action",
"Categories": [
"Space",
"Action"
],
"seriesRef": "string",
"Directors": [
"string"
],
"Producers": [
"string"
],
"TmsId": "GLOBAL_star_wars",
"contentType": "movie",
"SeasonNumber": 0,
"episodeNumber": 0,
"Episode": "string",
"year": 0,
"Images": [
"string"
],
"technicals": [
{
"id": "string",
"media": {
"AV_PlaylistName": {
"id": "string",
"fileName": "string",
"drmId": "string",
"drmInstanceName": "string",
"format": "string",
"uri": "string"
}
},
"isSTCU": true,
"isLTCU": true,
"guardTimeStart": "string",
"guardTimeEnd": "string",
"cUStartDate": 0,
"cUEndDate": 0
}
],
"position": 0,
"sportType": "string",
"ltcuRepresentationOfStcu": true,
"PromoImages": [
"string"
],
"nodeRefs": [
"string"
],
"DisplayPriority": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"InHomeBlockingRequired": true,
"CUStartDate": 0,
"CUEndDate": 0,
"period": {
"duration": 0,
"start": 0,
"end": 0
}
},
"id": "string",
"title": "string",
"contentRef": "string",
"rating": {
"code": "string",
"precedence": "string",
"title": "string"
},
"ratings": [
{
"code": "string",
"precedence": "string",
"title": "string"
}
],
"periodStart": "string",
"periodEnd": "string",
"airingStartTime": 0,
"airingEndTime": 0,
"promoImages": [
"string"
],
"serviceRef": "string",
"tmsId": "string",
"isnPvr": "string",
"isStartOver": true,
"isCatchUp": true,
"categories": [
"string"
],
"drmId": "string",
"contentType": "string",
"seasonNumber": 0,
"episodeNumber": 0,
"episode": 0,
"synopsis": "string",
"seriesRef": "string",
"images": [
{
"name": "small_16_9",
"aspectRatio": "string",
"height": 0,
"width": 0,
"uri": "string",
"hints": [
"string"
]
}
],
"technicals": [
{
"id": "string",
"isSTCU": true,
"isLTCU": true,
"media": {
"AV_PlaylistName": {
"frameDuration": 0,
"format": "string",
"id": "string",
"fileName": "string"
}
},
"deviceType": "string",
"promoImages": [
"string"
],
"prducts": {
"id": "string",
"startPurchase": "string",
"endValidity": "string",
"startValidity": "string",
"rentalDuration": 0,
"price": {
"startPurchase": 0,
"endPurchase": "string",
"currency": "string",
"value": 0
},
"platformRef": "string",
"endPurchase": 0,
"impulsive": true,
"regions": [
"string"
],
"title": "string",
"type": "string"
}
}
]
},
{
"btvServices": {
"id": "string",
"locale": "en_GB",
"isFreemium": true,
"deviceType": [
"ION"
],
"editorial": {
"id": "string",
"period": {
"duration": 0,
"start": 0,
"end": 0
}
},
"technical": {
"id": "string",
"period": {
"duration": 0,
"start": 0,
"end": 0
},
"catchUpSupport": true,
"startOverSupport": true,
"title": "string",
"shortName": "string",
"longName": "string",
"description": "string"
}
},
"btvProgramme": {
"type": "programme",
"editorial": {
"type": "editorial",
"id": "GLOBAL_star_wars",
"title": "Star Wars",
"Title": "Star Wars",
"Actors": [
"Harrison Ford"
],
"rating": {
"code": "string",
"precedence": "string",
"title": "string"
},
"ratings": [
{
"code": "string",
"precedence": "string",
"title": "string"
}
],
"duration": 120,
"Description": "Space action",
"Synopsis": "Space action",
"Categories": [
"Space",
"Action"
],
"seriesRef": "string",
"Directors": [
"string"
],
"Producers": [
"string"
],
"TmsId": "GLOBAL_star_wars",
"contentType": "movie",
"SeasonNumber": 0,
"episodeNumber": 0,
"Episode": "string",
"year": 0,
"Images": [
"string"
],
"technicals": [
{
"id": "string",
"media": {
"AV_PlaylistName": {
"id": "string",
"fileName": "string",
"drmId": "string",
"drmInstanceName": "string",
"format": "string",
"uri": "string"
}
},
"isSTCU": true,
"isLTCU": true,
"guardTimeStart": "string",
"guardTimeEnd": "string",
"cUStartDate": 0,
"cUEndDate": 0
}
],
"position": 0,
"sportType": "string",
"ltcuRepresentationOfStcu": true,
"PromoImages": [
"string"
],
"nodeRefs": [
"string"
],
"DisplayPriority": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"InHomeBlockingRequired": true,
"CUStartDate": 0,
"CUEndDate": 0,
"period": {
"duration": 0,
"start": 0,
"end": 0
}
},
"id": "string",
"title": "string",
"contentRef": "string",
"rating": {
"code": "string",
"precedence": "string",
"title": "string"
},
"ratings": [
{
"code": "string",
"precedence": "string",
"title": "string"
}
],
"periodStart": "string",
"periodEnd": "string",
"airingStartTime": 0,
"airingEndTime": 0,
"promoImages": [
"string"
],
"serviceRef": "string",
"tmsId": "string",
"isnPvr": "string",
"isStartOver": true,
"isCatchUp": true,
"categories": [
"string"
],
"drmId": "string",
"contentType": "string",
"seasonNumber": 0,
"episodeNumber": 0,
"episode": 0,
"synopsis": "string",
"seriesRef": "string",
"images": [
{
"name": "small_16_9",
"aspectRatio": "string",
"height": 0,
"width": 0,
"uri": "string",
"hints": [
"string"
]
}
],
"technicals": [
{
"id": "string",
"isSTCU": true,
"isLTCU": true,
"media": {
"AV_PlaylistName": {
"frameDuration": 0,
"format": "string",
"id": "string",
"fileName": "string"
}
},
"deviceType": "string",
"promoImages": [
"string"
],
"prducts": {
"id": "string",
"startPurchase": "string",
"endValidity": "string",
"startValidity": "string",
"rentalDuration": 0,
"price": {
"startPurchase": 0,
"endPurchase": "string",
"currency": "string",
"value": 0
},
"platformRef": "string",
"endPurchase": 0,
"impulsive": true,
"regions": [
"string"
],
"title": "string",
"type": "string"
}
}
]
}
},
{
"id": "string",
"contentType": "NonContent",
"index": 0
},
null
],
"size": 5
}
]
See also
For full details of this API, see the Content Delivery API documentation.