Content Discovery API Implementation#
Content Discovery enables dynamic browsing and display of content metadata, offering greater flexibility for filtering. This document focuses on the Content Discovery SDK's V2 API. All content discovery methods respond in three different formats.
Initialization of Content Discovery#
private ContentDiscovery contentDiscovery;
ContentDiscovery.initService(context, new IInFlightCallback() {
@Override
public void onInitServiceComplete(Object o, String s) {
//Initialized successfully
//Obtained the content discovery object, assigned it global ContentDiscovery object
contentDiscovery = (ContentDiscovery)o;
}
@Override
public void onInitServiceFailed(String s, InFlight.Error error) {
//Error during initialization of content discovery
}
}, inFlight);
Initializing the content discovery module is the first step in using Content Discovery. Once initialized, a ContentDiscovery object is created, which is then used to call all content discovery-related APIs. This initialization is a one-time process and does not need to be repeated before each API call. It is recommended to perform this initialization at the application level.
The ContentDiscovery.Listener#
The ContentDiscovery module offers the ContentDiscovery.listener interface handles responses from all content discovery methods. In other words, this interface must be implemented to use all content discovery methods effectively.
ContentDiscovery.Listener listener = new ContentDiscovery.Listener() {
@Override
public void onMapDataReceived(List<Map<String, Object>> data, List<Map<String, Object>> warning,
Map<String, Object> resultInfo,
ContentDiscovery.Method method, Map<String, String> request) {
// This method get called to provide the response of getCategories, getContentTypes, getItems, getItemsByCategories,
// getLaunguage, getTagValues, searchByField, searchByText.
}
@Override
public void onStringDataReceived(List<String> data, List<Map<String, Object>> warning, ContentDiscovery.Method method, Map<String, String> request) {
// This method get called to provide the response of getTag method.
}
@Override
public void onError(ContentDiscovery.Error error, ContentDiscovery.Method method, Map<String, String> request) {
// This method is called whenever an error occurs during a content discovery method invocation.
}
})
1. onMapDataReceived
The onMapDataReceived callback is invoked when structured metadata of media content is received, this method is invoked in all method calls except getTag method
Parameter:
-
data - A list of maps containing the metadata of the media content retrieved.
-
warning - A list of maps containing warning information related to the retrieved metadata
-
resultInfo - A map containing additional contextual information or processing details about the result.
-
method - The content discovery method used to retrieve the metadata.
-
request - A map containing the request parameters associated with this callback.
2. onStringDataReceived
The onStringData callback is invoked when flat string metadata of media content is received, this method is invoked only when the getTags method is used.
Parameters:
-
data - A list of strings containing the metadata of the media content
-
warning - A list of maps containing warning information related to the retrieved metadata.
-
method - The content discovery method used to retrieve the metadata.
-
request - A map containing the request parameters associated with this callback.
3. onError
The onError callback is invoked when an error occurs during content discovery.
Parameters:
-
error - The error object provides details about the issue.
-
method - The content discovery method during which the error occurred.
-
request - A map containing the request parameters that triggered the error.
The list of methods available in Content Discovery#
1. One-time configuration#
1.1. Set the seat class#
The seat class (e.g., First, Business) determines the category of seating for which content is displayed. If no seat class is specified, the default option, SeatClass.ALL will be used. It is recommended to set the seat class after initializing the Content Discovery process, as the content available may differ based on the selected seat category. Properly configuring the seat class ensures the most relevant content is provided for that seating type.
Parameters:
seatClass - Only accepts strings provided by SeatClass, such as first, business, or all.
Example
1.2 Set the language#
This specifies the ISO 639 language code, such as 'eng' for English. If no language is specified, the airline's default language will be used. To retrieve the list of languages available for the metadata, use the getLanguages method from the Content Discovery module. Please refer to the section 2.2 to get a list of languages.
Parameters:
languageCode - ISO 639 language code
Example
2. Fetch the essential data#
2.1 Get content types#
The method retrieves all content types associated with a specified content name. For example, if the content name is "media," the available content types could include audio, album, or TV. These content types, obtained through this API, are essential for use in various other Content Discovery APIs to filter content effectively
public void getContentTypes(String contentName,
@Nullable
Map<String,String> filter,
ContentDiscovery.Listener listener)
Parameters:
contentName (Optional) - Identifies the content. If not provided, returns content types for ALL components.
filter (Optional)
- format_version -The output response is updated to the new format when format_version is set to "2.0". This new format removes additional nesting when not useful. e.g. language codes, so that the response is easier to parse. The default output JSON structure is format_version 1.0
listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener#onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener#onError(Error, Method, Map) is called.
Example
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("format","2.0");
contentDiscovery.getContentTypes("media",optionalParameter,listener);
The provided example demonstrates how to retrieve a list of available content types by specifying a content name. In this case, the content name parameter is set to media. This means the query is focused on fetching all the distinct content types that fall under the broad category of media.
2.2 Get language list#
The method retrieves a list of all languages into which content has been translated into. These languages are determined based on where or how the language is used in the content (e.g., subtitles, audio, or descriptions).
Parameters:
filter (optional)
- format_version - The output response is updated to the new format when format_version is set to "2.0". This new format removes additional nesting when not useful, e.g. language codes, so that the response is easier to parse.
- usage - Pass to get a language list for a specific purpose. Values can be "Interactive", "Metadata", "Soundtrack", or "Subtitle". Case insensitive string. If not provided, the language list contains a list of all languages.
listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener#onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener#onError(Error, Method, Map) is called.
Example
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("format","2.0");
optionalParameter.put("usage","Metadata");
contentDiscovery.getLanguages(optionalParameter,listener);
3. Get data#
3.1 Get metadata by category#
This function is responsible for retrieving all the categories associated with a specified content name, such as media or marketplace. When only the content name is provided, the function returns a comprehensive list of all categories related to that content. However, if an additional parameter called category_root is specified, the function refines the output to include only those categories that belong to the given content name and are structured under the specified category root.
public void getCategories(String contentName,
@Nullable
Map<String,String> filter,
ContentDiscovery.Listener listener)
Parameters:
contentName (Required) - Identifies the content. e.g. media, marketplace.
filter (Optional) -
- category_root - Identifies the category root node of the category tree that is returned in the output e.g. movies, tv, etc
- lang - Identifies the translation language in which to return the data. If not provided returned data will be in default translation.
- format - Identifies the translation language in which to return the data. If not provided returned data will be in default translation.
- image_size_selector - Returns images in the sizes specified by the airlines. To request multiple sizes, provide a comma-separated list of size selectors. If both
image_size_selectorandimage_resolutionare specified,image_size_selectortakes precedence. If neither is provided, all images will be returned. - image_resolution - Returns images in the specified resolution, formatted as width x height (e.g., "800x600").To request multiple resolutions, use a comma-separated list. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes precedence. If neither is specified, all images will be returned. - image_type - Returns images of the specified type, such as "poster" or "synopsis." To request multiple types, use a comma-separated list. If this field is not provided, all image types will be returned based on the remaining image input parameters
- requested_fields - Indicate the fields to be returned. For multiple fields, separate them with a comma (,). If this parameter is provided, only the specified fields will be included in the response; otherwise, all fields will be returned.
- parent_id - The parameter is used to filter categories, ensuring that only those categories with the specified ID as their parent are included in the output.
- tree_depth - This parameter is used to retrieve a hierarchical category structure up to a specified depth level. By default, the depth is set to 0, meaning the API returns the entire category tree beneath the specified
category_rootorparent_id. This includes all nested subcategories at every level.- Depth = 1 retrieves only the immediate child categories directly under the specified node.
- Depth = 2 fetches both the immediate children and their direct subcategories, and so on.
listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener#onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener#onError(Error, Method, Map) is called.
Example
- Get categories without root categories
The above example provided a list of all the categories that belong to the media content scope.
- Get categories with root categories
Map<String,String> optionalParameter = new HashMap<>();
optionalParameter.put("category_root","movies");
optionalParameter.put("format","2.0");
contentDiscovery.getCategories("media", optionalParameter,listener);
In the given example, the root category is "Movies," and the content name is "Media." Based on these inputs, the function will return a list of subcategories under Movies, such as Action, Drama, and Comedy that are associated with the Media content type.
- Get the categories for the home screen
Map<String,String> optionalParameter = new HashMap<>();
optionalParameter.put("parent_id","100");
optionalParameter.put("format","2.0");
contentDiscovery.getCategories("media", optionalParameter,listener);
In this particular example, the content scope is defined as "media," and the parent_id parameter is assigned a value of 100. It is important to note that for the home screen, the parent_id is always set to 100. This specific combination of parameters is designed to be used for retrieving data related to the home screen. When these parameters are provided in the API request, the response includes a variety of content categories, such as Movies, TV, and Audio, among others.
The API provides the capability to accept both the category_root and parent_id parameters in a request. However, when both parameters are supplied, the API prioritizes category_root over parent_id. This means that if category_root is present in the request, the API will primarily use it to determine the response, potentially ignoring parent_id. Therefore, if the goal is to retrieve data specifically based on the parent_id, it is essential to exclude the category_root parameter from the request to ensure that the API processes the request using parent_id as the primary filter.
Note: The root category is not always specified in the media kit. If the root category is undefined, the content discovery will not provide the data.
After retrieving the list of categories, the getItemByCategory API can be used to fetch the items associated with a specific category. Please refer to the Section 4.2
3.2. Get metadata using tags#
3.2.1. Get tags list#
The API retrieves a list of tags associated with a specific content type. These tags can be used to retrieve data. Examples of tags include genre, rating, actor, director, and others.
public void getTags(String contentType,
@Nullable
Map<String,String> filter,
ContentDiscovery.Listener listener)
Parameters:
contentType (Required) - Identifies the content. A comma-separated list, where each token supports ending with a wildcard, for example, media., media.video., media.audio.*.
filter (Optional)
- format_version - The output response is updated to a new format when
format_versionis set to "2.0". This format eliminates unnecessary nesting, such as for language codes, making the response easier to parse. The default output JSON structure isformat_version1.0.
listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener#onStringDataReceived(List, List, Method, Map) is called. If an error occurs, ContentDiscovery.Listener#onError(Error, Method, Map) is called.
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("format","3.0");
contentDiscovery.getTags("media.video.movie",optionalParameter,listener);
In the example above, we retrieve a list of tags associated with the content type media.video.movie. Additionally, the optional parameter format is set to version 3.0. The resulting data will be delivered to the onStringDataReceived method of the ContentDiscovery.Listener interface.
3.2.2. Get values based on tags#
This method is used to retrieve a list of all the unique values associated with a specific tag for a particular content type.
public void getTagValues(String contentType,
List<String> tagNames,
Map<String,String> filter,
ContentDiscovery.Listener listener)
Parameters:
contentType (Required) - identifies the content. Comma-separated list, where each token supports ending with a wildcard. Examples: media., media.video., media.audio.*.
tagNames (Required) - Pre-defined or custom fields that can be specific to the airline. This value should come from the "get_tags" API. If more than one custom field is given, use an "OR" between the custom fields.
filter (Optional) - Request parameters, such as tag_filter_value, image_size_selector, and image_resolution.
-
lang - Indicates the translation language for the returned data. If not specified, the data will be returned in the default translation. e.g. eng
-
image_size_selector - Returns images in the size specified by the airlines. To request multiple image sizes, use a comma-separated list of size selectors. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes precedence. If neither is specified, all images will be returned. -
image_resolution - Returns images in the specified resolution, formatted as width x height (e.g., "800x600").To request multiple resolutions, use a comma-separated list. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes priority. If neither is provided, all images will be returned. -
image_type - Returns images in the specified type, such as "poster," "synopsis," etc. To request multiple image types, use a comma-separated list. If this field is not provided, all types will be returned based on the other image input parameters.
-
format_version - The output response is updated to a new format when
format_versionis set to "2.0". This format reduces unnecessary nesting, such as for language codes, making the response easier to parse. The default output JSON structure isformat_version1.0. When "2.0" is used, the response also includes aresult_infosection withtotal_items, which represents the total number of items for the query, independent of pagination. -
tag_filter_value - Identifies additional filters for each tag name to narrow the result. e.g. "genre"="genre_id",
listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener#onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener#onError(Error, Method, Map) is called.
List<String> tagNameList = new ArrayList<>();
tagNameList.add("actor");
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("format","3.0");
optionalParameter.put("year","2022");
contentDiscovery.getTagValues("media.video.movie",tagNameList,optionalParameter,listener);
In the example provided, data is being fetched for the content type media.video.movie based on the actor tag, which is included in the input list. Furthermore, an optional parameter map is used to apply an additional filter on the year tag, with a specified value of 2022. This ensures that the retrieved data contains only the actors associated with movies released in 2022.
The output from this method is then utilized in the getItems method, allowing us to fetch movies categorized by actors specifically for the year 2022. This approach enables precise filtering and categorization of movies based on both actors and release year. Please refer to section 4.1 example 2.
3.3 Search for metadata#
3.3.1. Search by field#
The method retrieves a list of content items by filtering based on specific attributes such as artist, director, title, year, or a combination of these fields. It enables precise searches by allowing users to specify one or more criteria to locate relevant content efficiently.
public void searchByField(Map<String,String> requiredFields,
@NullableMap<String,String> filter,
ContentDiscovery.Listener listener)
Parameters:
requiredFields (Required) - A filter for each tag name to refine the results. At least one field is required, and multiple fields can be used. The service will perform an "AND" operation between the different fields.
-
title
-
genre
-
year
-
artist
-
actor
-
director
filter (Optional) - Request parameters, such as content_type, match_type, offset, page_size, and requested_fields.
- content_type - Identifies the content. Comma-separated list, where each token supports ending with a wildcard. If not provided, ALL contents will be searched e.g. media., media.video., media.video.movie
- seat_class - Class associated with the seatback monitor. If not provided, 'all' class will be used
- offset - Pagination parameter. Skip this number of items in the result. The default value is 0. If this number is negative, 0 will be used. If it's greater than the total amount of the matched data, nothing will be returned. e.g. offset=60&page_size=15, the first 60 items will be skipped and the 61st to 75th, if available, will be returned.
- page_size - Pagination parameter. This is the maximum number of items returned in the result. e.g. if offset=60, page_size=15, the 61st to 75th records will be returned. The default value is 150.
- requested_fields - Returns the specified fields along with the ID and field name. If this parameter is provided, only the specified fields will be included in the response. Otherwise, all default fields will be returned. The
content_urifield is always included. If some special fields by default are not obtained then those fields we need to provide explicitly. The requested field applies to both parents and children. - lang - Indicates the translation language for the returned data. If not specified, the data will be returned in the default translation. e.g. eng
- image_size_selector - Returns images in the size specified by the airlines. To request multiple image sizes, use a comma-separated list of size selectors. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes precedence. If neither is specified, all images will be returned. - image_resolution - Returns images in the specified resolution, formatted as width x height (e.g., "800x600").To request multiple resolutions, use a comma-separated list. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes priority. If neither is provided, all images will be returned. - image_type - Returns images in the specified type, such as "poster," "synopsis," etc. To request multiple image types, use a comma-separated list. If this field is not provided, all types will be returned based on the other image input parameters.
- format_version - The output response is updated to a new format when
format_versionis set to "2.0". This format reduces unnecessary nesting, such as for language codes, making the response easier to parse. The default output JSON structure isformat_version1.0. When "2.0" is used, the response also includes aresult_infosection withtotal_items, which represents the total number of items for the query, independent of pagination.
listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener#onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener#onError(Error, Method, Map) is called.
Example 1 :
Map<String,String> requiredField = new HashMap<>();
requiredField.put("actor","tom");
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("format","2.0");
optionalParameter.put("content_type","media.video.movie");
contentDiscovery.searchByField(requiredField,optionalParameter,listener);
In the example above, we are searching for data items where the actor's name contains the keyword "Tom." This search will return results for actors such as Tom Hanks, Tommy Lee, and Tom Cruise. Additionally, we have specified the content type as "movie," so the method will only provide a list of movies featuring these actors, filtering out content of other types.
Example 2:
Map<String,String> requiredField = new HashMap<>();
requiredField.put("actor","tom");
requiredField.put("year","2022");
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("format","2.0");
optionalParameter.put("content_type","media.video.movie");
contentDiscovery.searchByField(requiredField,optionalParameter,listener);
In the example above, we have also included the "year" field, which ensures that the data retrieved is specifically limited to the year 2022.
3.3.2. Search by text#
The method allows you to perform a free-text search across multiple fields, including Title, Genre, Year, Artist, Actor, and Director. It searches for the specified text in any of these fields, treating all fields equally, and ensuring flexible search results.
public void searchByText(String text,
@Nullable
Map<String,String> filter,
ContentDiscovery.Listener listener)
Parameters:
text (Required) - Sets the filter text. This free text is searched in the Title, Genre, Year, Artist, Actor, and Director fields.
filter (Optional) - Request parameters, such as content_type, match_type, offset, page_size, and requested_fields.
- content_type - Identifies the content. Comma-separated list, where each token supports ending with a wildcard. If not provided, ALL contents will be searched e.g. media., media.video.
- seat_class - Class associated with the seatback monitor. If not provided, the 'all' class will be used
- offset - Pagination parameter. Skip this number of items in the result. The default value is 0. If this number is negative, 0 will be used. If it's greater than the total amount of the matched data, nothing will be returned. e.g. offset=60&page_size=15, the first 60 items will be skipped and the 61st to 75th, if available, will be returned.
- page_size - Pagination parameter. This is the maximum number of items returned as a result. e.g. if offset=60, page_size=15, the 61st to 75th records will be returned. The default value is 150.
- requested_fields - Returns the specified fields along with the ID and field name. If this parameter is provided, only the specified fields will be included in the response. Otherwise, all default fields will be returned. The
content_urifield is always included. If some special fields by default are not obtained then those fields we need to provide explicitly. The requested field applies to both parents and children. - lang - Indicates the translation language for the returned data. If not specified, the data will be returned in the default translation. e.g. eng
- image_size_selector - Returns images in the size specified by the airlines. To request multiple image sizes, use a comma-separated list of size selectors. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes precedence. If neither is specified, all images will be returned. - image_resolution - Returns images in the specified resolution, formatted as width x height (e.g., "800x600").To request multiple resolutions, use a comma-separated list. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes priority. If neither is provided, all images will be returned. - image_type - Returns images in the specified type, such as "poster," "synopsis," etc. To request multiple image types, use a comma-separated list. If this field is not provided, all types will be returned based on the other image input parameters.
- format_version - The output response is updated to a new format when
format_versionis set to "2.0". This format reduces unnecessary nesting, such as for language codes, making the response easier to parse. The default output JSON structure isformat_version1.0. When "2.0" is used, the response also includes aresult_infosection withtotal_items, which represents the total number of items for the query, independent of pagination.
listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener#onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener#onError(Error, Method, Map) is called.
Example
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("format","2.0");
optionalParameter.put("content_type","media.video.movie");
contentDiscovery.searchByText("tom",optionalParameter,listener);
In the example above, the keyword "tom" is used to search across all the fields mentioned earlier (Title, Genre, Year, Artist, Actor, and Director). By default, the search would include all content types. However, since "movie" is specified as the content type in the optional parameter, the search will be limited to movies containing the keyword "tom" in any of the specified fields.
4. Get Items#
4.1. Get a list of items using content type or tag values#
The method retrieves a list of items that match the specified content type and tag value, allowing for precise filtering of content based on these criteria.
public void getItems(String contentType,
@Nullable
Map<String,String> filter,
ContentDiscovery.Listener listener)
Parameters:
contentType (Required) - Identifies the content. Comma-separated list, where each token supports ending with a wildcard. Examples: media.*, media. video.*, media.audio.*.
filter (Optional) - Request parameters, such as offset, page_size, requested_fields, image_size_selector, and image_resolution.
- lang - Indicates the translation language for the returned data. If not specified, the data will be returned in the default translation. e.g. eng
- offset - Pagination parameter that specifies the number of items to skip in the results. The default value is 0. If a negative number is provided, 0 will be used. No results will be returned if the value exceeds the total number of matched items.
- page_size - Pagination parameter specifying the maximum number of items to return in the result. If
page_sizeis not provided or set to 0, the default value of 150 will be used. Ifpage_sizeis set to -1, all items will be returned. - requested_fields—Returns the specified fields along with the ID and field name. If this parameter is provided, only the specified fields will be included in the response. Otherwise, all default fields will be returned. The content_uri field is always included. If some special fields are not obtained by default, then we need to provide those fields explicitly.
- image_size_selector - Returns images in the size specified by the airlines. To request multiple image sizes, use a comma-separated list of size selectors. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes precedence. If neither is specified, all images will be returned. - image_resolution - Returns images in the specified resolution, formatted as width x height (e.g., "800x600"). To request multiple resolutions, use a comma-separated list. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes priority. If neither is provided, all images will be returned. - image_type - Returns images in the specified type, such as "poster," "synopsis," etc. To request multiple image types, use a comma-separated list. If this field is not provided, all types will be returned based on the other image input parameters.
- sort_order - Identifies the type of sort, such as "ascending", or "descending".
- order_by - Specifies the field name by which to sort the results.
- format_version - The output response is updated to a new format when
format_versionis set to "2.0". This format eliminates unnecessary nesting (e.g., for language codes), making the response easier to parse. The default output JSON structure isformat_version1.0. Additionally, when "2.0" is used, the response includes aresult_infosection withtotal_items, which represents the total number of items for the query, regardless of pagination. - native_language_names - If specified and greater than 0, the "language_name" in the soundtrack/subtitle section of the response will be the
language_isolanguage (if a translation forlanguage_isoexists). Otherwise, "language_name" will be in thelanglanguage (as specified by the query parameter or the default language).
listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener onError(Error, Method, Map) is called.
Example 1:
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("format","2.0");
optionalParameter.put("page_size","-1");
contentDiscovery.getItems("media.video.movie",optionalParameter,listener);
In the example above, the content type is specified as a movie, and the page size is set to -1. This configuration indicates that the method will retrieve a complete list of all available movies without any limit on the number of results
Example 2:
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("format","2.0");
optionalParameter.put("page_size","-1");
optionalParameter.put("actor","832481800");
contentDiscovery.getItems("media.video.movie",optionalParameter,listener);
In the example above, the content type is set to "movie," and the actor tag value is assigned the ID 83248180, which was retrieved using the getTagList and getTagValueList APIs. As a result, the method provides a list of all movies associated with the actor corresponding to the tag value 83248180.
4.2. Get the list of items by categories#
Retrieves list of all items for multiple categories and grouped by category.
public void getItemsbyCategories(String contentType,
List<Integer> categoryIds,
@Nullable
Map<String,String> filter,
ContentDiscovery.Listener listener)
Parameters:
contentType (Required) - Identifies the content. Comma-separated list, where each token supports ending with a wildcard. Examples: media, games, ebooks, media. video.*, media.video.movie.
categoryIds (Required) - The category IDs, separated by commas (,), for which you want to retrieve the media listing (e.g., 1,2,3).
filter (Optional) Request parameters, such as offset, page_size, requested_fields, image_size_selector, and image_resolution.
- lang - Indicates the translation language for the returned data. If not specified, the data will be returned in the default translation. e.g. eng
- offset - Pagination parameter that specifies the number of items to skip in the results. The default value is 0. If a negative number is provided, 0 will be used. No results will be returned if the value exceeds the total number of matched items.
- page_size - Pagination parameter specifying the maximum number of items to return in the result. If
page_sizeis not provided or set to 0, the default value of 150 will be used. Ifpage_sizeis set to -1, all items will be returned. - requested_fields — Returns the specified fields along with the ID and field name. If this parameter is provided, only the specified fields will be included in the response. Otherwise, all default fields will be returned. The content_uri field is always included. If some special fields are not obtained by default, then we need to provide those fields explicitly.
- image_size_selector - Returns images in the size specified by the airlines. To request multiple image sizes, use a comma-separated list of size selectors. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes precedence. If neither is specified, all images will be returned. - image_resolution - Returns images in the specified resolution, formatted as width x height (e.g., "800x600"). To request multiple resolutions, use a comma-separated list. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes priority. If neither is provided, all images will be returned. - image_type - Returns images in the specified type, such as "poster," "synopsis," etc. To request multiple image types, use a comma-separated list. If this field is not provided, all types will be returned based on the other image input parameters.
- format_version - The output response is updated to a new format when
format_versionis set to "2.0". This format reduces unnecessary nesting, such as for language codes, making the response easier to parse. The default output JSON structure isformat_version1.0. When "2.0" is used, the response also includes aresult_infosection withtotal_items, which represents the total number of items for the query, independent of pagination - native_language_names - If specified and greater than 0, the "language_name" in the soundtrack/subtitle section of the response will correspond to the
language_isolanguage (if a translation forlanguage_isoexists). Otherwise, "language_name" will be in thelanglanguage (as specified by the query parameter or the default language).
listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener#onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener#onError(Error, Method, Map) is called.
Example
//Optional parameter
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("format", "2.0");
optionalParameter.put("page_size","10");
//List of categories those are obtained with the helpf of getItemsbyCategories method
List<Integer> categoryList = new ArrayList<>();
categoryList.add(101);
categoryList.add(102);
contentDiscovery.getItemsbyCategories("media.video.movies", categoryList, optionalParameter, listener);
In the given example, we retrieve a list of items categorized by specific categories. To do this, we pass a list of category IDs as input. Additionally, we include optional parameters such as format and page size. The page size parameter limits the result to only 10 records.
5. Get the item’s detail#
Retrieves detailed information about items based on a list of content URIs. The retrieved details include properties such as the title, description, genre, rating, media URI, unique identifier (MID), soundtrack, subtitle, the count of associated content, and the URIs of those associated contents.
public void getItemsDetail(List<String> contentUris,
@Nullable
Map<String,String> filter,
ContentDiscovery.Listener listener)
Parameters:
contentUris (Required) - List of content URIs for which detail is required.
filter (Optional) Request parameters, such as requested_fields, image_size_selector, image_resolution, and image_type.
- requested_fields - Returns the specified fields along with the ID and field name. If this parameter is provided, only the specified fields will be included in the response. Otherwise, all default fields will be returned. The
content_urifield is always included. If some special fields by default are not obtained then those fields we need to provide explicitly. The requested field applies to both parents and children. - lang - Indicates the translation language for the returned data. If not specified, the data will be returned in the default translation. e.g. eng
- image_size_selector - Returns images in the size specified by the airlines. To request multiple image sizes, use a comma-separated list of size selectors. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes precedence. If neither is specified, all images will be returned. - image_resolution - Returns images in the specified resolution, formatted as width x height (e.g., "800x600").To request multiple resolutions, use a comma-separated list. If both
image_size_selectorandimage_resolutionare provided,image_size_selectortakes priority. If neither is provided, all images will be returned. - image_type - Returns images in the specified type, such as "poster," "synopsis," etc. To request multiple image types, use a comma-separated list. If this field is not provided, all types will be returned based on the other image input parameters.
- format_version - The output response is updated to a new format when
format_versionis set to "2.0". This format reduces unnecessary nesting, such as for language codes, making the response easier to parse. The default output JSON structure isformat_version1.0. When "2.0" is used, the response also includes aresult_infosection withtotal_items, which represents the total number of items for the query, independent of pagination. - native_language_names - If specified and greater than 0, the "language_name" in the soundtrack/subtitle section of the response will correspond to the
language_isolanguage (if a translation forlanguage_isoexists). Otherwise, "language_name" will be in thelanglanguage (as specified by the query parameter or the default language).
listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener#onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener#onError(Error, Method, Map) is called.
Example
Map<String, String> optionalParameter = new HashMap<>();
optionalParameter.put("lang","eng");
optionalParameter.put("request_fields","title, description");
List<String> mediaUriList = new ArrayList<>();
mediaUriList.add("media:abc124111");
mediaUriList.add("media:abc124122");
contentDiscovery.getItemsDetail(mediaUriList, optionalParameter, listener);
In the example above, two media URIs were provided in the list, along with optional parameters: lang set to "eng" (English) and requested_field specifying "title" and "description." This means the method will retrieve only the title and description for the specified media URIs in English.
How to subscribe UMB topic for content discovery?#
i/srvcs/cd/units/{LRU_HOSTNAME}/service/status (CD 03.09+ and UMB config 283+)
https://umbconfigtool.nextcloud.aero/topics/gLZEXcw7e3PWv4AA4nutMc
Triggers for this Event#
-
When CD client starts the first time after seat reboot if data is available
-
New data is pushed to the seat by NBD
-
This occurs after LMS pushes a new kit and server regenerates the index to push
-
Origin, destination, flight number, route id, media date, or open flight TD changes
-
Will only be sent if flight is open
-
On open flight, these TDs are guaranteed to change so this event is guaranteed after open flight
Behavior Expected From Interactive:
"ready" is always true, this event is not meant to store state or immediately return that CD is available or not.
This event means that CD has either just come up or the loaded data has changed.
Interactive is to assume CD is available when it comes up and try to fetch. It will receive a 502 or 504 error CD is not up yet or data has not yet been pushed to the seat respectively.
Interactive is to subscribe to this event, and refresh whenever the event is published. Interactive will know CD is available by either getting a non 500* error on first attempt or when this event comes in. Do not wait for this event for the first attempt to pull CD data, as CD will not send it again if it came up or data was pushed BEFORE interactive came up.
504 error status (Content Discovery 03.24+, PACOS 2503+):
When new data is pushed mid-flight, there will be a brief period on the seat, after new index has been pushed, leading up to a new i/srvcs/cd/units/+/service/status topic being called, where CD will return 504 errors.
This error status is also sent when no data has been loaded to the seat yet.
The expected response from Inflight Android SDK during this period will be
If the airline program receives data pushed remotely during flight, there may be a 2–20 second window where CD returns 504 errors before the UMB status topic is received. Interactive should be designed to handle these error states gracefully and always refresh when the UMB status topic arrives.