Overview

This is an unofficial, third party API developed and maintained by Martin Ivanov for retrieving data from IMDb.

Responses from the method calls are in JSONP format and the service is free (but donations are very welcome), however providing an API key along with the requests is required.

This service is not endorsed by or affiliated with IMDb.

API Endpoint

http://imdb.wemakesites.net/api

Authentication

To start using the API you should register for a free API key below. Please, use a valid email address as the API key will be emailed to you. The email you provide will be kept safe and not given or sold to third parties. I will only use it to send occasional updates regarding the API and for nothing else.

Making Requests to the API

Get IMDb Data by Resource ID

The resource_id is the part of the IMDb URL in bold, for example: http://www.imdb.com/name/nm0000314.

http://imdb.wemakesites.net/api/:resource_id

JSONP Example with jQuery

$('form[name="get-data-by-resource-id"]').on("submit", function(e) { var form = $(this); e.preventDefault(); $.ajax({ url: 'http://imdb.wemakesites.net/api/' + form.find('select').val(), crossDomain: true, data: { api_key: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' }, dataType: 'jsonp', success: function(data) { window.console.log(data); } }); });

cURL Example with PHP

<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'imdb.wemakesites.net/api/nm0000115?api_key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'); // Nicolas Cage curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); echo $output; curl_close($ch); ?>

Search IMDb

Use this method to perform a site-wide, category-agnostic search of IMDB.

http://imdb.wemakesites.net/api/search?q=keyword

JSONP Example with jQuery

$('form[name="search-imdb"]').on("submit", function(e) { var form = $(this); e.preventDefault(); $.ajax({ url: "http://imdb.wemakesites.net/api/search", data: form.serialize(), // assuming the form has a hidden input with api_key name, containing your API key crossDomain: true, dataType: "jsonp", success: function(data) { window.console.log(data); } }); });

cURL Example with PHP

<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'imdb.wemakesites.net/api/search?q=Nicolas+Cage&api_key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); echo $output; curl_close($ch); ?>

Status Messages

All requests to the API return status, code and message keys along with the retrieved data.

OK ("success", 200)

Status is returned after a successful data retrieval.

{ "status": "success", "code": 200, "message": "ok" }

Not Found ("fail", 404)

Status is returned after an unsuccessful attempt for data retrieval, resulted from HTTP 404 on the IMDb's side.

{ "status": "fail", "code": 404, "message": "Resource not found" }

Missing IMDb ID ("fail", 1)

Status is returned if the API is accessed without supplying resource_id (http://imdb.wemakesites.net/api/IMDB_RESOURCE_ID).

{ "status": "fail", "code": 1, "message": "IMDb ID not set" }

API Key not Provided ("fail", 2)

The error is returned when no API key has been passed as a query parameter in the request.

{ "status": "fail", "code": 2, "message": "API Key not provided. Get one for free from http://imdb.wemakesites.net and include is as api_key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx parameter to your requests to the API." }

Invalid API Key ("fail", 3)

The error is returned when an invalid key has been passed as a query parameter in the reuqest.

{ "status": "fail", "code": 3, "message": "The provided API key is invalid. Get one for free from http://imdb.wemakesites.net and include is as api_key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx parameter to your requests to the API." }