Returning cast members with odata netflix query
I am trying 开发者_JAVA技巧to get the list of cast members in a movie when I request titles by genre and ratings.
I use: dim catalogitem = (For g in Genre For t in g.titles Where t.genre = "Westerns" Where t.rating >=4 select t).Take(100)
This works great, but I also want the cast members of these movies. How do I change this query to include returning the cast members also?
Your help is greatly appreciated.
Thanks
Tony
I know that you can expand cast using the OData URI:
http://odata.netflix.com/Catalog/Titles?$filter=Name%20eq%20'The%20Name%20of%20The%20Rose'&$expand=Cast&$format=json
From this page: http://blogs.msdn.com/b/bethmassi/archive/2011/02/16/fun-with-odata-and-windows-phone-7.aspx
It looks like what you need to do is define the expand when you're defining the URL for the request:
Dim url = String.Format("/Genres('{0}')?$expand=Titles", Me.textBox1.Text)
Dim uri = New Uri(url, UriKind.Relative)
So for your case: Dim url = String.Format("/Genres('{0}')?$expand=Cast", Me.textBox1.Text)
Note that you'll also need to change your query to ask for the Cast:
from t in Titles select new {t, t.Cast}
精彩评论