Ols1
Ols1

Reputation: 321

Using the Netflix Odata service with WP71

I'm trying to use the Netflix Odata service with WP71 but it aint working. What's wrong with this code?

private const string NETFLIX_CATALOG_URI = "http://odata.netflix.com/v2/Catalog/";

public ObservableCollection<Title> SearchByTitle(string searchKey)
    {
        NetflixCatalog catalog = new NetflixCatalog(new Uri(NETFLIX_CATALOG_URI));

        var query = catalog.Titles.Where(t => t.Name.Contains(searchKey));

        DataServiceCollection<Title> titles = new DataServiceCollection<Title>(catalog);
        titles.LoadAsync(query);
        return titles;
    }

Upvotes: 0

Views: 228

Answers (1)

Jinlin Tong
Jinlin Tong

Reputation: 41

If you look at the HTTP request generated from your Linq, you will notice that the format is not supported by Netflix. It will work if you change it to:

var query = catalog.Titles.Where(t => t.Name.StartsWith(searchKey));

But, of course, it is not exactly the search you want... and I am looking for the answer on that too.

Upvotes: 1

Related Questions