API

Ga naar: navigatie, zoeken

(English below)

De MovieMeter API is een XML-RPC webservice waarmee je vanuit externe websites en applicaties informatie kunt opvragen over films en regisseurs. Via deze weg is het mogelijk om makkelijk en snel Nederlandstalige filminformatie op te halen en te tonen in bv. externe websites, filmcollectie software en media center systemen.

Doel van de API is niet om de complete set aan beschikbare functionaliteiten aan te bieden, en zo externe partijen in staat te stellen een "eigen" MovieMeter te schrijven bovenop de aangeboden webservices. Om deze reden is het niet mogelijk om bv. in te loggen, berichten te plaatsen, en te stemmen via de API. Het is eventueel wel toegestaan om met behulp van de API een website of applicatie te maken die als primair doel heeft om informatie van MovieMeter te tonen. Maak in je applicatie echter wel duidelijk dat je applicatie slechts gebruik maakt van onze informatie, maar dat deze geen officieel onderdeel van MovieMeter is. Noem je applicatie ook geen "MovieMeter" of iets dergelijks. De applicatie of website moet gratis en vrij van reclame zijn. Voldoe je niet aan deze voorwaarden bestaat de kans dat je de toegang tot de API wordt ontzegd.

Gebruik van de API en de gegevens die je er mee ophaalt is gratis bij het niet-commerciëel gebruik, en wanneer je de bron vermeldt (bij voorkeur met een link naar de betreffende film- of regisseurpagina). Mocht je de API commerciëel willen gebruiken, neem dan svp contact op met Jordy op info@moviemeter.nl. MovieMeter houdt zich te allen tijde het recht voor om de voorwaarden van deze API te wijzigen, individuele API keys in te trekken, of de API in zijn geheel te stoppen.

Aangezien er ook niet-Nederlandstalige gebruikers van de API zijn, zal de rest van deze pagina in het Engels zijn.

English introduction

The MovieMeter API is a XML-RPC webservice which you can use to retrieve film information in Dutch. This API is not intented to provide a complete set of MovieMeter functionalities, for instance the API doesn't provide operations to log in, vote or place new messages. You are allowed to create a website or application which has a primary goal of showing MovieMeter information. However, you must make it clear that while you're application uses our information, it's not made by MovieMeter. Also don't name your application "MovieMeter" or something similar. The application or website must be free of charge and ads. If you don't comply to these rules, your access to the API could be revoked.

Usage of this API is free for non-commercial use, and if you provide a link to MovieMeter to the users of your application. If you would like this use this API commercially, please contact Jordy at info@moviemeter.nl.

MovieMeter reserves the right to change the usage terms, revoke individual API keys or stop providing the service altogether.

Usage

Before you can make a request to the server, you have to register yourself as a client by requesting an API key by visiting this url. You can put this key hardcoded in the source of your website or application. You will need this key to start sessions. You can start sessions by using the startSession() method. You'll have to send your api key to this method, and you will retrieve a session key. This session key is used to do "real" requests to the API.

The API was not created to provide you with an easy solution for creating your own personal copy of the MovieMeter database. There no longer is a limit on the amount of sessions per ip, or the amount of requests per session, but each ip address that uses the api can perform a maximum of 5000 requests a day. If you think you are using the web service fairly, but you are still bothered by these limits, please let me know so we can discuss this.

Messages

An example of a call to the web service is the following XML message. In this message the film.getScore() method is called, with a previously retrieved session key and the filmId "500" as parameters.

<?xml version="1.0"?>
<methodCall>
 <methodName>film.getScore</methodName>
 <params>
   <param>
       <value><string>e3dee9d19a8c3af7c92f9067d2945b59</string></value>
   </param>
   <param>
       <value><int>500</int></value>
   </param>
 </params>
</methodCall>


If the session key was valid, and the film with filmId 500 was found, the server will return information about the current score of the film in a struct (array) with the following format:

<?xml version="1.0"?>
<methodResponse>
 <params>
   <param>
     <value>
       <struct>
         <member>
           <name>votes</name>
           <value><string>5564</string></value>
         </member>
         <member>
           <name>total</name>
           <value><string>23255</string></value>
         </member>
         <member>
           <name>average</name>
           <value><string>4.18</string></value>
         </member>
       </struct>
     </value>
   </param>
 </params>
</methodResponse>


You will probably not need to create these XML messages yourself. Most major programming language provide native support for XML-RPC calls, or have free external libraries which you can use.

PHP example

In the following example, the "XML-RPC for PHP" library is used, which you can find here: http://phpxmlrpc.sourceforge.net/

<?php
require("xmlrpc.inc");
require("xmlrpcs.inc");
require("xmlrpc_wrappers.inc");

// start client
$client = new xmlrpc_client("http://www.moviemeter.nl/ws");
$client->return_type = 'phpvals';



// request api key at http://www.moviemeter.nl/site/registerclient/
$api_key = 'somestring'; 


/*
   STEP 1
   start session and retrieve sessionkey
*/

$message = new xmlrpcmsg("api.startSession", array(new xmlrpcval($api_key, "string")));
$resp = $client->send($message);

if ($resp->faultCode()) {
   die('error: '. $resp->faultString());
}
else {
   $session_info = $resp->value();
   $session_key = $session_info['session_key'];
}



/*
   STEP 2
   search for film
*/

$message = new xmlrpcmsg("film.search", array(new xmlrpcval($session_key, "string"), new xmlrpcval("lord of the rings", "string")));
$resp = $client->send($message);

if ($resp->faultCode()) {
   die('error: '. $resp->faultString());
}
else {
   $results = $resp->value();

   echo 'search results:';
   var_dump($results);
}

PHP example for showing images

<?php

// CHANGE THIS! request api key at http://www.moviemeter.nl/site/registerclient/
$api_key = 'abcdefg';

// CHANGE THIS! path to writable directory
$path = 'path/to/writable/dir/';


$filmId = intval($_GET['filmId']);

if ($filmId == 0)
{
	exit;
}

$path_to_file = $path . 'mome_' . $filmId . '.jpg';

if (is_file($path_to_file))
{
	// use image from local cache
	$contents = file_get_contents($path_to_file);
}
else
{
	require("xmlrpc.inc");
	require("xmlrpcs.inc");
	require("xmlrpc_wrappers.inc");

	// start client
	$client = new xmlrpc_client("http://www.moviemeter.nl/ws");
	$client->return_type = 'phpvals';


	// retrieve session key
	$message = new xmlrpcmsg("api.startSession", array(new xmlrpcval($api_key, "string")));
	$resp = $client->send($message);
	$session_info = $resp->value();
  	$session_key = $session_info['session_key'];

	// retrieve image
	$message = new xmlrpcmsg("film.retrieveImage", array(new xmlrpcval($session_key, "string"), new xmlrpcval($filmId, "int")));
	$resp = $client->send($message);
	$image = $resp->value();
	$contents = base64_decode($image['image']['base64_encoded_contents']);

	// cache this image
	$handle = fopen($path_to_file, 'w+');
	fwrite($handle, $contents);
	flose($handle);
}

// output file
echo $contents;
?>

if you place these contents in a file called image.php, and want to show the image for filmId 1234, use this html:

<IMG src="http://www.yoursite.com/image.php?filmId=1234"> 


You are welcome to add examples for other languages by modifying this Wiki page.

C# .Net example

In the following example, the "CookComputing.XmlRpc" library is used, which you can find here: http://www.xml-rpc.net/
or download directly from http://xmlrpcnet.googlecode.com/files/xml-rpc.net.2.4.0.zip.
Paste the following code into a 'Visual C# Windows Forms Application'-form and add a reference to the CookComputing.XmlRpc.dll.
Further implementation, error-handling and the rest is up to you. For info about the API or the key contact Jordy.


using System;
using System.Windows.Forms;
using System.Collections;
using System.Net;

using CookComputing.XmlRpc; // Add a reference to the CookComputing.XmlRpc.dll to the project
// Can be downloaded from: http://www.xml-rpc.net/ 
// Latest version at the moment 2.4.0: http://xmlrpcnet.googlecode.com/files/xml-rpc.net.2.4.0.zip

namespace mmApi
{
    public partial class Form1 : Form
    {

        private IMMApi apiProxy;
        private string url = "http://www.moviemeter.nl/ws";
        private string apiKey = "your_apikey_here";

        private string sessionKey = "";
        private int sessionValidTill = 0;

        public Form1()
        {
            InitializeComponent();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            testMethod();
        }

        private void testMethod()
        {
            // Some examples (using 'Lord of the Rings'):

            // Start with a connection
            apiProxy = (IMMApi)XmlRpcProxyGen.Create(typeof(IMMApi));

            // Retrieve the moviemeter-id from a known imdb-id:
            string mmid = apiProxy.RetrieveByImdb(getSessionKey(), "0120737");

            // Or search moviemeter
            Film[] filmlist = apiProxy.Search(getSessionKey(), "Lord of the Rings");
            foreach(Film f in filmlist)
            {
                //loop trough the filmlist and use the result for something
                string tmpTitle = f.title;
                string tmpId = f.filmId;
            }

            // Get the filmdetails with the known moviemeter-id
            FilmDetail detail = apiProxy.RetrieveDetails(getSessionKey(), Int32.Parse(mmid)); // retrieved this id before
            foreach(FilmDetail.Actor a in detail.actors)
            {
                //loop trough the actorlist 
                string tmpActorName = a.name;
            }
            foreach(string g in detail.genres)
            {
                //loop trought the genres
                string tmpGenre = g;
            }
            string directorId = detail.directors[0].id;

            // Some other movies from this director 
            DirectorFilm[] dirfilmlist = apiProxy.DirectorRetrieveFilms(getSessionKey(), Int32.Parse(directorId));
            foreach(DirectorFilm df in dirfilmlist)
            {
                int filmid = Int32.Parse(df.filmId);
                // and get the details of this specific movie
                FilmDetail detail2 = apiProxy.RetrieveDetails(getSessionKey(), filmid);
            }
        }

        /// <summary>
        /// Requests for a new sessionkey of it's not initialized yet or not valid anymore
        /// otherwise the known sessionkey will be used
        /// </summary>
        /// <returns>String with a valid sessionkey</returns>

        private string getSessionKey()
        {
            //sessionValidTill: Seconds since the Unix Epoch, can be used for about 30 minutes 
            if ( (new DateTime(1970,1,1)).AddSeconds(sessionValidTill) < DateTime.Now.ToUniversalTime() )
            {
                apiProxy = (IMMApi)XmlRpcProxyGen.Create(typeof(IMMApi));
                ApiStartSession s = apiProxy.StartSession(apiKey);
                sessionKey = s.session_key;
                sessionValidTill = s.valid_till;
            }
            return sessionKey;
        }

    }

}




/// <summary>
/// The XmlRpcMethod representation of the available methods
/// </summary>

[XmlRpcUrl("http://www.moviemeter.nl/ws")]
public interface IMMApi : IXmlRpcProxy
{
    /* The following methods are currently (19-06-2009) available:
    system.listMethods() 
    system.methodHelp(string method_name) 
    system.methodSignature(string method_name)

    api.startSession(string apikey), returns array with sessionkey and unix timestamp for session's expiration date 
    api.closeSession(string sessionkey), returns boolean 
    film.search(string sessionkey, string search), returns array with films 
    film.retrieveScore(string sessionkey, int filmId), returns array with information about the current score (average, total, amount of votes) 
    film.retrieveImdb(string sessionkey, int filmId), returns array with imdb code, url, score and votes for this film 
    film.retrieveByImdb(string sessionkey, string imdb code), returns filmId corresponding to the imdb code supplied 
    film.retrieveDetails(string sessionkey, int filmId), returns array with information about the film 
    director.search(string sessionkey, string search), returns array with directors 
    director.retrieveDetails(string sessionkey, int directorId), returns array with director's information 
    director.retrieveFilms(string sessionkey, int directorId), returns array with director's films 
     */

    [XmlRpcMethod("api.startSession")]
    ApiStartSession StartSession(string apikey);

    [XmlRpcMethod("api.closeSession")]
    bool CloseSession(string sessionkey);

    [XmlRpcMethod("film.search")]
    Film[] Search(string sessionkey, string search);

    [XmlRpcMethod("film.retrieveScore")]
    FilmScore RetrieveScore(string sessionkey, int filmId);

    [XmlRpcMethod("film.retrieveImdb")]
    FilmImdb RetrieveImdb(string sessionkey, int filmId);

    [XmlRpcMethod("film.retrieveByImdb")]
    string RetrieveByImdb(string sessionkey, string imdb_code);

    [XmlRpcMethod("film.retrieveDetails")]
    FilmDetail RetrieveDetails(string sessionkey, int filmId);

    [XmlRpcMethod("director.search")]
    Director[] DirectorSearch(string sessionkey, string search);

    [XmlRpcMethod("director.retrieveDetails")]
    DirectorDetail DirectorRetrieveDetails(string sessionkey, int directorId);

    [XmlRpcMethod("director.retrieveFilms")]
    DirectorFilm[] DirectorRetrieveFilms(string sessionkey, int directorId);



}


/// <summary>
/// Definitions for the method-results
/// In these classes more functionality can be added (like conversion to int or date)
/// </summary>

public class ApiStartSession
{
    public string session_key;
    public int valid_till;
    public string disclaimer;

}

public class ApiError
{
    public string faultCode;
    public string faultString;
}

public class Film
{
    public string filmId;
    public string url;
    public string title;
    public string alternative_title;
    public string year;
    public string average;
    public string votes_count;
    public string similarity;

}

public class FilmScore
{
    public string votes;
    public string total;
    public string average;
}

public class FilmImdb
{
    public string code;
    public string url;
    public string score;
    public int votes;
}

public class FilmDetail
{
    public string url;
    public string thumbnail;
    public string title;
    public Title[] alternative_titles;
    public string year;
    public string imdb;
    public string plot;
    public string duration;
    public Duration[] durations;
    public Actor[] actors;
    public string actors_text;
    public Director[] directors;
    public string directors_text;
    public Country[] countries;
    public string countries_text;
    public string[] genres;
    public string genres_text;
    public Date[] dates_cinema;
    public Date[] dates_video;
    public string average;
    public string votes_count;
    public int filmId;

    public class Duration
    {
        public string duration;
        public string description;
    }

    public class Actor
    {
        public string name;
        public string voice;
    }
    public class Director
    {
        public string id;
        public string name;
    }
    public class Country
    {
        public string iso_3166_1;
        public string name;
    }
    public class Date
    {
        public string date;
    }
    public class Title
    {
        public string title;
    }
}

public class Director
{
    public string directorId;
    public string url;
    public string name;
    public string similarity;
}

public class DirectorDetail
{
    public string url;
    public string thumbnail;
    public string name;
    public string born;
    public string deceased;
}

public class DirectorFilm
{
    public string filmId;
    public string url;
    public string title;
    public string alternative_title;
    public string year;
}





VB .Net example

In the following example, the "CookComputing.XmlRpc" library is used, which you can find here: http://www.xml-rpc.net/
or download directly from http://xmlrpcnet.googlecode.com/files/xml-rpc.net.2.4.0.zip.
Paste the following code into a 'VB.Net Class' and add a reference to the CookComputing.XmlRpc.dll.
Further implementation, error-handling and the rest is up to you. For more information about this example: michel@canguru.it. For info about the API or the key contact Jordy.

Imports CookComputing.XmlRpc ' Add a reference to the CookComputing.XmlRpc.dll to the project

' Can be downloaded from: http://www.xml-rpc.net/ 
' Latest version at the moment 2.4.0: http://xmlrpcnet.googlecode.com/files/xml-rpc.net.2.4.0.zip

Public Interface MovieMeterApi
    Inherits IXmlRpcProxy
    'Specify the target method and arguments to be passed
    <XmlRpcMethod("api.registerClient")> _
    Function getApiKey(ByVal strWebsite As String, ByVal strMailAdres As String) As String

    <XmlRpcMethod("api.startSession")> _
    Function GetSessionInfo(ByVal strApiKey As String) As XmlRpcStruct

    <XmlRpcMethod("film.search")> _
    Function GetFilm(ByVal strSessionKey As String, ByVal strFilm As String) As Object

    <XmlRpcMethod("film.retrieveDetails")> _
    Function GetFilmDetails(ByVal strSessionKey As String, ByVal iFilmID As Integer) As XmlRpcStruct

    <XmlRpcMethod("film.retrieveScore")> _
    Function GetFilmScore(ByVal strSessionKey As String, ByVal iFilmID As Integer) As Object
End Interface
Public Class Moviemeter


    Private MovieMeterProxy As MovieMeterApi
    Private ClientProtocol As XmlRpcClientProtocol
    Private cdpURL As String
    Public strSessionID As String
    Public strApiKey As String = "Your Key Here"
    Public Sub GetStarted()
        Dim strSessionKey As String = Nothing

        MovieMeterProxy = CType(XmlRpcProxyGen.Create(GetType(MovieMeterApi)), MovieMeterApi)
        ClientProtocol = CType(MovieMeterProxy, XmlRpcClientProtocol)
        cdpURL = "http://www.moviemeter.nl/ws"
        ClientProtocol.Url = cdpURL

        If strSessionID Is Nothing Then
            If Not strApiKey Is Nothing Then
                If Not strApiKey.Trim.Length = 0 Then

                    Dim SessionInfoStruct As New XmlRpcStruct
                    Try
                        SessionInfoStruct = MovieMeterProxy.GetSessionInfo(strApiKey)
                    Catch ex As Exception
                        GetStarted()
                    End Try

                    If Not SessionInfoStruct Is Nothing Then
                        strSessionKey = SessionInfoStruct.Item("session_key")
                    End If

                End If
            End If
            If Not strSessionKey Is Nothing Then
                strSessionID = strSessionKey
            End If

        Else
            If Me.strSessionID.ToString.Trim.Length = 0 Then
                If Not strApiKey Is Nothing Then
                    If Not strApiKey.Trim.Length = 0 Then

                        Dim SessionInfoStruct As New XmlRpcStruct
                        SessionInfoStruct = MovieMeterProxy.GetSessionInfo(strApiKey)
                        If Not SessionInfoStruct Is Nothing Then
                            strSessionKey = SessionInfoStruct.Item("session_key")
                        End If

                    End If
                End If
                strSessionID = strSessionKey
            End If

        End If

    End Sub
    Public Function GetScore(ByVal iFilmID As Integer) As Double
        If Not strSessionID Is Nothing Then
            If strSessionID.ToString.Trim.Length = 0 Then
                GetStarted()
            End If
        Else
            GetStarted()
        End If


        Dim MovieScore As XmlRpcStruct


        MovieScore = MovieMeterProxy.GetFilmScore(strSessionID, iFilmID)
        If Not MovieScore Is Nothing Then
            Return Val(MovieScore.Item("average").ToString.Trim)
        Else
            Return Nothing
        End If

    End Function
    Public Function GetFilms(ByVal strFilmNaam As String) As Array
        If Not strSessionID Is Nothing Then
            If strSessionID.ToString.Trim.Length = 0 Then
                GetStarted()
            End If
        Else
            GetStarted()
        End If

        Dim MovieInfoObject As Object
        Dim bOK As Boolean = True
        If Not strSessionID Is Nothing Or strFilmNaam Is Nothing Then
            If Not strSessionID.Trim.Length = 0 Or strFilmNaam.Trim.Length = 0 Then

                Dim iFilmID As Integer = 0

                Try
                    MovieInfoObject = MovieMeterProxy.GetFilm(strSessionID, strFilmNaam)
                Catch ex As Exception
                    bOK = False
                End Try

            Else
                bOK = False
            End If
        Else
            bOK = False
        End If

        If bOK = True Then

            If Not MovieInfoObject Is Nothing Then
                Dim arr As Array
                arr = TryCast(MovieInfoObject, Array)

                If Not arr Is Nothing Then
                    Return arr
                Else
                    Return Nothing
                End If

            Else
                Return Nothing
            End If
        Else
            Return Nothing
        End If
    End Function
    Public Function GetFilmData(ByVal strFilmNaam As String) As Object
        If Not strSessionID Is Nothing Then
            If strSessionID.ToString.Trim.Length = 0 Then
                GetStarted()
            End If
        Else
            GetStarted()
        End If

        If Not strSessionID Is Nothing Or strFilmNaam Is Nothing Then
            If Not strSessionID.Trim.Length = 0 Or strFilmNaam.Trim.Length = 0 Then

                Dim iFilmID As Integer = 0
                Dim MovieInfoObject() As Object
                Try
                    MovieInfoObject = MovieMeterProxy.GetFilm(strSessionID, strFilmNaam)
                Catch ex As Exception
                    Return Nothing
                    Exit Function
                End Try


                Dim MovieInfoStruct As XmlRpcStruct
                If MovieInfoObject.Length > 0 Then


                    MovieInfoStruct = MovieInfoObject(0)

                    If Not MovieInfoStruct Is Nothing Then
                        iFilmID = CInt(MovieInfoStruct.Item("filmId"))
                        Dim MovieDetailsObject As XmlRpcStruct
                        Try
                            MovieDetailsObject = MovieMeterProxy.GetFilmDetails(strSessionID, iFilmID)
                        Catch ex As Exception
                            Return Nothing
                            Exit Function
                        End Try
                        Return MovieDetailsObject
                    End If
                Else
                    Return Nothing
                    Exit Function
                End If
            Else
                Return Nothing
            End If
        Else
            Return Nothing
        End If

    End Function
    Public Function GetFilmDetailedData(ByVal iFilmID As Integer) As Object
        If Not strSessionID Is Nothing Then
            If strSessionID.ToString.Trim.Length = 0 Then
                GetStarted()
            End If
        Else
            GetStarted()
        End If

        If Not strSessionID Is Nothing Then
            If Not strSessionID.Trim.Length = 0 Or iFilmID = 0 Then
                Dim MovieDetailsObject As XmlRpcStruct
                Try
                    MovieDetailsObject = MovieMeterProxy.GetFilmDetails(strSessionID, iFilmID)
                Catch ex As Exception
                    Return Nothing
                    Exit Function
                End Try
                Return MovieDetailsObject

            End If
        End If
    End Function


Next to do is to compile your class to a DLL or put this class in your form/web application. To use this class you can use the next code.

Dim MoviemeterApi As New Moviemeter

'To get a list of movie with a search use this code.

Dim arrMovieList As Array
arrMovieList = MoviemeterApi.GetFilms("Movie Title Here")

        If Not arrMovieList Is Nothing Then
            If arrMovieList.Length > 0 Then

		 For iMovieListCount as Integer = 0 To FilmLijst.Length - 1

		     Dim MovieResult As New XmlRpcStruct
		     MovieResult = arrMovieList(iMovieListCount)
		     Dim strMovieID as string = MovieResult.Item("filmId")
		     Dim strMovieTitle as string =  MovieResult.Item("title")
		     'You can do this for all the properties in the xmlRpcStruct.

		 Next

	    End If
	End If


'To get information of a single movie by its moviemeter number use this code.

	Dim iMovieNumber as integer = 1 'you can put the desired moviemeter number in here.
	Dim MovieResult As XmlRpcStruct = MoviemeterApi.GetFilmDetailedData(iMovieNumber)
	If Not FilmResults Is Nothing Then

	   Dim strMovieID as string = MovieResult.Item("filmId")
	   Dim strMovieTitle as string =  MovieResult.Item("title")
	   Dim strMMscore As String = MovieResult.Item("average").ToString.Trim
	   'You can do this for all the properties in the xmlRpcStruct.

	End If

Objective-C example

This is an example of an iPhone-project which uses the Cocoa XML-RPC Framework available at http://github.com/eczarny/xmlrpc. After you added the framework to your project, add the following code to your interface file (.h) of your View Controller (the View Controller in this example is called 'SearchViewController'):

        #import <UIKit/UIKit.h>
        #import "XMLRPCRequest.h"
        #import "XMLRPCConnectionManager.h"
        #import "XMLRPCConnection.h"
        #import "XMLRPCResponse.h"

       @interface SearchViewController : UIViewController <XMLRPCConnectionDelegate> {
		
       }
	
       @end

In the implementation file (.m) of your View Controller, add the following code to the viewDidLoad method:

        - (void)viewDidLoad 
	{
		[super viewDidLoad];
		
		NSURL *url = [NSURL URLWithString:@"http://www.moviemeter.nl/ws"];
		XMLRPCRequest *sessionRequest = [[XMLRPCRequest alloc] initWithURL:url];
		[sessionRequest setMethod:@"api.startSession" withParameter:@"your_apikey"]; // replace your_apikey with your API key
		NSError *error;
		XMLRPCResponse *response = [XMLRPCConnection sendSynchronousXMLRPCRequest:sessionRequest error:&error];
		[sessionRequest release];
		
		if ([response isFault]) 
		{
			// Error handling
		}
		else
		{
			// Session is created, perform search
			
			XMLRPCRequest *searchRequest = [[XMLRPCRequest alloc] initWithURL:url];
			XMLRPCConnectionManager *manager = [XMLRPCConnectionManager sharedManager];
			
			// Replace search_value with a keyword to search
			
			[searchRequest setMethod:@"film.search" withParameters:[NSArray arrayWithObjects:[[response object] 
                                objectForKey:@"session_key"], @"search_value", nil]];
			[manager spawnConnectionWithXMLRPCRequest:searchRequest delegate:self];
			[searchRequest release];
		}
	}

Add the following delegate methods to your implementation file:

        #pragma mark -
	#pragma mark XMLRPCConnectionDelegate Methods

	- (void)request: (XMLRPCRequest *)request didReceiveResponse: (XMLRPCResponse *)response 
	{
	        if ([response isFault]) 
	        {
			// Error handling
		
			UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[[response faultCode] stringValue] 
                                 message:[response faultString] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
			[alert show];
			[alert release];
	        }
		else 
		{
			// Log the NSDictionary object which contains the search results
			
			NSLog(@"%@", [response object]);
	        }
	}

	- (void)request: (XMLRPCRequest *)request didFailWithError: (NSError *)error;
	{
		// Error handling
	}

	- (BOOL)request: (XMLRPCRequest *)request canAuthenticateAgainstProtectionSpace: (NSURLProtectionSpace *)protectionSpace
	{
		return YES;
	}
	
	- (void)request: (XMLRPCRequest *)request didReceiveAuthenticationChallenge: (NSURLAuthenticationChallenge *)challenge
	{
		
	}

	- (void)request: (XMLRPCRequest *)request didCancelAuthenticationChallenge: (NSURLAuthenticationChallenge *)challenge
	{
	
	}

Further implementation, error-handling and the rest is up to you. For more information about this example: stefan@codesurface.nl. For info about the API or the key contact Jordy.

API

The following methods are currently available

  • system.listMethods()
  • system.methodHelp(string method_name)
  • system.methodSignature(string method_name)

  • api.startSession(string apikey), returns array with sessionkey and unix timestamp for session's expiration date
  • api.closeSession(string sessionkey), returns boolean

  • film.search(string sessionkey, string search), returns array with films
  • film.retrieveScore(string sessionkey, int filmId), returns array with information about the current score (average, total, amount of votes)
  • film.retrieveImdb(string sessionkey, int filmId), returns array with imdb code, url, score and votes for this film
  • film.retrieveByImdb(string sessionkey, string imdb code), returns filmId corresponding to the imdb code supplied
  • film.retrieveDetails(string sessionkey, int filmId), returns array with information about the film
  • film.retrieveImage(string sessionkey, int filmId), returns array with information and base64 encoded contents of poster and its thumbnail
  • film.retrieveReviews(string sessionkey, int filmId), retrieve summarized reviews for the film
  • film.retrieveReview(string sessionkey, int filmId, int messageId), retrieves full review

  • film.retrieveCinema(string sessionkey)
  • film.retrieveVideo(string sessionkey)
  • film.retrieveTv(string sessionkey)
  • film.retrieveTvAll(string sessionkey)

  • director.search(string sessionkey, string search), returns array with directors
  • director.retrieveDetails(string sessionkey, int directorId), returns array with director's information
  • director.retrieveFilms(string sessionkey, int directorId), returns array with director's films
  • director.retrieveImage(string sessionkey, int directorId), returns array with information and base64 encoded contents of director image (if exists) and its thumbnail
Afkomstig van MovieMeterWiki, het compendium aan informatie over MovieMeter. "http://wiki.moviemeter.nl/index.php?title=API&oldid=10187"