Skip to content
Olabode Olaleye edited this page Apr 6, 2022 · 14 revisions

Hello, this is the main page of the wiki, here you will find some examples about the use of the javascript library.

Before you start you will need a valid api key to interact with the RESTful API of themoviedb.org, please go to their website and ask for one.

Once you have the api key, you can start using the library, below you will find all the available methods including the description and usage example of each of them.

If you find any error with the library or the description please fill a new bug on the issues section.

Library Configuration

At the top of the themoviedb.js file you will see something like:

api_key: "",
base_uri: "http://api.themoviedb.org/3/",
images_uri: "http://image.tmdb.org/t/p/",
timeout: 2000,

You will need to update the api_key variable with your api key, you can do this by modifying the file directly or programmatically, for example:

theMovieDb.common.api_key = "apikey";

Currently the RESTful API allow the use of SSL conections, if you like to use that feature you will need to change the base_uri parameter and images_uri, as follow:

theMovieDb.common.base_uri = "https://api.themoviedb.org/3/";

and

theMovieDb.common.images_uri = "https://image.tmdb.org/t/p/";

The last configuration parameter is the timeout, currently it is set to 5000 milliseconds (5 seconds) but you can change it:

theMovieDb.common.timeout = 2000

API Methods

In this example i'm using two callbacks functions (one for success and one for error responses) that you can define like:

function successCB(data) {
	console.log("Success callback: " + data);
};
        
function errorCB(data) {
        	console.log("Error callback: " + data);
    };

The libray matches one on one with the API described in https://developers.themoviedb.org if you find any error please submit an add bug.

Status Code

Check the possible returned status codes here.

API Reference

Check the API latest news here.

Clone this wiki locally