APIMASH: The Rotten Tomatoes API Starter Kit – The Undocumented API
Rotten Tomatoes Starter Kit
Loading...
X

APIMASH: The Rotten Tomatoes API Starter Kit

The APIMASH Rotten Tomatoes Starter Kit is a XAML/C# Windows 8 app based on the default Grid Template that demonstrates calling the Rotten Tomatoes API’s.

For an overview of the APIMASH Starter Kits and their architecture see this article.

The JSON payload for Movies or DVD’s is deserialized into a set of C# classes that define the Data Model. That data then is selectively copied into the View Model for binding to the WinRT XAML controls.

Features

  • Invokes the Rotten Tomatoes REST API (http://developer.rottentomatoes.com/)
  • Demonstrates how to deserialize JSON to C# and bind to WinRT XAML Controls
  • Provides a baseline for a Windows 8 Store App

Requirements

Setup

Updating APIMASHLib

APIMASHLib by default is using a third party library for JSON deserialization, JSON.NET. The APIMASHLib project in the Rotten Tomatoes Starter Kit Solution will show that the Newtonsoft.Json reference is broken so you will need to update that reference.

image

There are 2 ways to update the reference to the Newtonsoft JSON.NET library in the APIMASHLIb project; a) Use NuGet, b) download the Zip from Json.codeplex.com and reference the DLL in the WinRT folder.

Using NuGet

To use NuGet, in Visual Studio navigate the menu Tools > Library Package Manager > Manage NuGet Package for Solution.

image

Search for Json.NET and install. Request to add it to the APIMASHLib project.

image

Customization

Step 1. Get the Starter Kit up and running

Open the APIMASH_RottenTomatoes_StarterKit solution in Visual studio and open the Globals.cs source file. You can add your Developer Key on line 20

// STEP 1. ADD YOUR DEV KEY HERE
public static string ROTTEN_TOMATOES_API_KEY = @"apikey=[YOUR-DEV-KEY-HERE]";

Note that the ‘[ ]’ should be removed as well.

Update the reference to the JSON.NET library in the APIMASHLib project to point to where the DLL is installed on your system.

Press F5.

By default the application displays results from the InTheaters API. The app also allows you to drill into a movie item to get an overview and see reviews.

screenshot_05282013_160358

screenshot_05282013_160402

In the next step we will look at modifying the API call.

Step 2. Choose your API

In the Global.cs file you will find URI’s for the 9 API’s that Rotten Tomatoes offers.

Note that the Movie JSON payload provides URI’s to additional APIs such as reviews, cast, similar and clips. The Starter Kit implements the Review API as an example of how to access and use these additional ‘sub’ API”s.

Here is a complete list of the Rotten Tomatoes API’s

  • movies.json – list of movies
    • movie.json – info on an individual movie
      • reviews.json – the reviews for an individual movie
      • cast.json – the full cast for an individual movie
      • similar.json – a list of movies similar to the individual movie
      • clips.json – a list of clips related  to an individual movie
  • box_office.json – a current list of box office movies
  • upcoming.json -movies that are upcoming
  • in_theaters.json – movies that are in theaters
  • opening.json – movies that are opening this week
  • top_rentals.json  – top dvd rentals
  • current_releases.json – dvds that are currently released
  • new_releases.json – dvds that are getting released
  • upcoming.json – dvds that are getting released

Each of the 9 top level API’s returns the same JSON payload format. This makes working with the Rotten Tomatoes API very straightforward. The Starter Kit can easily be customized to display results from any of the top level API’s. I encourage you to experiment  by changing the API selection in the GroupedItemsPage.Xaml.cs file on line 76 from

ROTTEN_TOMATOES_API_MOVIES_INTHEATERS

to

ROTTEN_TOMATOES_API_DVD_TOPRENTALS

private void Invoke()
{
        _apiInvokeInTheaters.OnResponse += apiInvoke_OnResponseInTheaters;

        // STEP 2. Change the API here to see different movie listings
        //var apiCall = Globals.ROTTEN_TOMATOES_API_MOVIES_INTHEATERS;
        var apiCall = Globals.ROTTEN_TOMATOES_API_DVD_TOPRENTALS;
        _apiInvokeInTheaters.Invoke<RottenTomatoesMovies>(apiCall);
}

screenshot_05282013_161331

Step 3. Update the API Parameters

You can modify the parameters to each query such as the limit of the number of movies to return in total, or per page and the country.

Experiment by changing the ‘country’ parameter on the ‘TopRentalsAPI call on line 27 of Globals.cs from ‘us’ to ‘uk’.

public static string ROTTEN_TOMATOES_API_DVD_TOPRENTALS = @"http://api.rottentomatoes.com/api/public/v1.0/lists/dvds/top_rentals.json?limit=20&country=uk&" + ROTTEN_TOMATOES_API_KEY;

screenshot_05282013_161448

Experiment with other parameter to learn the API. Visit the API I/O Docs page to experiment on line.

Step 4. Mash it up

Movie information is EXTREMELY mashable! Experiment by combining Rotten Tomatoes with Bing Maps showing nearby movie theaters. Check out the Tom-Tom Bing Map Starter Kit or the Meetup POI Starter Kit to see how you can combine data from one API to overlay on Bing Maps.

Step 5. Submit your app to the Windows 8 Store

Once you have customized your app you are ready to submit it to the store. You will want to reserve your app name, create a set of unique Tiles and of course test, test and test so more. For an complete overview of the store submission process check out this article.

You can find a step by step guidance for sore submission here.

Conclusion

Building compelling apps requires compelling data. Open Data API’s are an excellent way to gather and mashup new experiences for end users. To learn more attend one of our in-person workshops or one of our Webcast Series on the APIMASH Starter Kits.  Each session will run from Noon – 1pm EDT. Attend one or all four webcasts, you decide. For more details or to register, choose a webcast below.

6/5/2013 | Exploring the Mashery APIs

Register
In this webcast you will learn how to develop Windows 8 apps using Mashery API’s such as Tom-Tom, Edmunds, Rotten Tomatoes and Active.com. Amit Jotwani from Mashery will join us to provide an overview of Mashery the industry leader in API management. We will cover how to access these web service API’s and then deserialize the response into a set of runtime objects that you can bind to Windows 8 UX Controls to create a compelling experience.

6/12/2013 | Exploring the Social Networking APIs

Register
In this webcast you will learn how to develop Windows 8 apps using the Twitter, Meetup and Facebook APIs. Twitter, Meetup and Facebook are the premier social networking sites and their API’s provide access to Tweets, Meetups and Friends. What a great combination!

6/19/2013 | Exploring the Yelp API

Register
In this webcast you will learn how to develop Windows 8 apps using the Yelp API. Yelp is a local business directory service and review site with social networking features. People use Yelp to search for everything from the city’s tastiest burger to the most renowned cardiologist.

6/25/2013 | Exploring the Bing Maps API

Register
In this webcast you will learn how to develop Windows 8 apps using the Bing Maps API. Bing Maps gives you a rich set of tools to help you create amazing map experiences perfect for mash-ups.

Lastly don’t forget to check out the “Keep the Cash Rewards” offer to see how you can get $100 for publishing your app(s) in the Windows Store and/or Windows Phone Store. Publish your app before June 30, 2013 and you can get a $100 virtual Visa card for every qualified app you enter (up to $2000*). Learn more.

-bob

3 observations on “APIMASH: The Rotten Tomatoes API Starter Kit
  1. Pingback: APIMASH: Using API’s to create compelling Windows Apps | bob familiar

  2. Pingback: Announcing WOWAPI and APIMASH - free Starter Kits for your Windows Store Apps - DaveDev - Site Home - MSDN Blogs

Leave Your Observation

Your email address will not be published. Required fields are marked *

Read previous post:
API Mashup Web Cast Series

Join Microsoft Technical Evangelists for four app mashup webcasts featuring the APIMASH Starter Kits built using APIs from Yelp, Bing,...

Close