This repository has been archived by the owner. It is now read-only.
A simple JS object to call the API of TheMovieDB.
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
LICENSE Initial commit Aug 27, 2014
README.md Get Started and Usage Aug 27, 2014
tmdb.js Fix IE error (do not know JSON response type) Sep 5, 2014

README.md

tmdb-js

A simple JS object to call the API of TheMovieDB.

Get Started

First, insert the script into your HTML file :

<script type="text/javascript" src="/path/to/tmdb.js"></script>

Set your api_key on line 4.
(You can make calls to the API with SSL/TLS by modifying the uri to begin with https:// instead of http://)

Test the script by making a simple call with the console :

tmdb.call("/configuration", {},
  function(e){
    console.log("Success: "+e)
  }, 
  function(e){
    console.log("Error: "+e)
  }
)

It should always return a JSON object. If you get the error callback, then it's probably that you made a mistake in your api_key or in the url (first argument of tmdb.call).

Usage

tmdb.call(url, params, success, error)

url (String) : The method you want to call, beginning with "/". See all methods here
params (Object) : Set your parameters here. Api_key is already included, no need to add it again ;) For example (calling method /search/movie) :

{
  "query": "The Hitchhiker's Guide to the Galaxy",
  "year": 2005,
  include_adult: false
  
}

success & error (Functions) : Callbacks with one argument to get the data, already parsed as JSON.