Articles



How to Query for International Trailers

Jason Schneid, Client Services Representative | Jul 11, 2012

This document reviews how to draft a query for international trailers in the IVA database using OData.
IVA captures many  trailers in different languages and subtitles to reach a wide variety of audiences.  The queries and information below will help you decide the best version of our trailers to show or include in your website or application based on the information about the video.   
When it comes to International trailers there are 3 fields in the VideoAssets Entity that you will want to consider:
  • Target Country
  • Language Spoken
  • Language Subtitled
The best practice for finding a foreign language trailer that meets your needs is to start with a query that looks for a match in any of the above fields.   That query will look like example 4 below.  It is also a best practice to have a backup in case there is no trailer in the language you select in which case you will want to default to the main trailer or default video asset.  The results from example 4 below will show if there are any video assets that have a Target Country, Language Spoken, or Language Subtitled set to France/French for the movie “The Hunger Games”.    
Notice that we are using the PromotesPublishedId field with the PublishedID of the title.   Foreign language trailers are alternate versions of our main trailer and the PromotesPublishedID field is the mapping back to that main record.  The results show us that there is a trailer for this title subtitled in French and targeted to France.   Since the target country is set to France this trailer should only be used for that audience and NOT other French speaking countries.  The reason for this may be that the release dates for other countries could be different or there might be something in the trailer that is designed to be relevant only to France.  
IVA’s collection of international  trailers is rapidly growing daily.  Make sure you are regularly checking our OData API for the newest information and trailers.



Example Queries:

  1. Getting a list of target country ID’s:

Linq: Countries.take(500)

URL: http://api.internetvideoarchive.com/1.0/DataService/Countries()?$top=500&Developerid={yourID}


  1. Getting a list of Language ID’s:

Linq: Languages.Take (500)

URL: http://api.internetvideoarchive.com/1.0/DataService/Languages()?$top=500&DeveloperID={yourID}


  1. Getting video assets for a target country France :

Linq: From v In VideoAssets Where v.TargetCountryId = 5 Select v

URL: http://api.internetvideoarchive.com/1.0/DataService/VideoAssets()?$filter=((cast(TargetCountryId,'Edm.Int32')) eq 5)&DeveloperID={yourID}


  1. Getting a foreign video asset for a specific title with Target Country, Language Spoken or Language Subtitle = France/French.

Linq: From e in VideoAssets where (e.TargetCountryId = 5 or e.LanguageSpokenId = 3 or e.LanguageSubtitledId = 3) and e.PromotesPublishedId = 501799 select e

URL: http://api.internetvideoarchive.com/1.0/DataService/VideoAssets()?$filter=((((cast(TargetCountryId,'Edm.Int32')) eq 5) or ((cast(LanguageSpokenId,'Edm.Int32')) eq 3)) or ((cast(LanguageSubtitledId,'Edm.Int32')) eq 3)) and (PromotesPublishedId eq 501799) )&DeveloperID={yourID}