Skip to content

The Movie DB

Projekt «WebApp»

Hier wird die öffentliche REST-Schnittstelle dokumentiert.

Wir werden für unsere WebApp auf die Version 3 der öffentlichen API der Filme- und Serien-Sammlung von TMDB zugreifen:

Dokumentation

Die API von TMDB ist hier dokumentiert:

Authentifizierung

Um auf die API zugreifen zu können, wird ein Schlüssel verwendet. Diesen muss man zuerst erzeugen. Dazu braucht man einen TMDB-Account. Den Schlüssel muss man dann bei jeder Anfrage mitschicken.

Endpoints

Hier einige für uns interessante Endpoints:

Z.B. Serien die in der letzten Woche gefragt sind:

url
https://api.themoviedb.org/3/trending/tv/week?api_key=<key>
json
{
  "page": 1,
  "results": [
    {
      "backdrop_path": "/3cgRI0hOq3dYyezSYrsfdmqxtMw.jpg",
      "id": 114922,
      "name": "Citadel",
      "overview": "What if you lost your memory? What if a spy didn’t know they were a spy? Years ago, the top agents of Citadel, Mason Kane and Nadia Sinh, had their minds wiped. But, they’re called back to action as sinister forces emerge from the past. With the help of spymaster Bernard Orlick, these former lovers must remember the past to save the future.",
      "poster_path": "/AcrDB32TqpAGwvQFbICALGxSzn3.jpg",
      "popularity": 346.31,
      "first_air_date": "2023-04-27",
      "vote_average": 8.3,
      "vote_count": 46
    },
    {
      "backdrop_path": "/nTvM4mhqNlHIvUkI1gVnW6XP7GG.jpg",
      "id": 85937,
      "name": "Demon Slayer: Kimetsu no Yaiba",
      "overview": "It is the Taisho Period in Japan. Tanjiro, a kindhearted boy who sells charcoal for a living, finds his family slaughtered by a demon. To make matters worse, his younger sister Nezuko, the sole survivor, has been transformed into a demon herself. Though devastated by this grim reality, Tanjiro resolves to become a “demon slayer” so that he can turn his sister back into a human, and kill the demon that massacred his family.",
      "poster_path": "/xUfRZu2mi8jH6SzQEJGP6tjBuYj.jpg",
      "popularity": 338.452,
      "first_air_date": "2019-04-06",
      "vote_average": 8.699,
      "vote_count": 5119
    }
  ],
  "total_pages": 1000,
  "total_results": 20000
}

oder die Filme des Tages:

url
https://api.themoviedb.org/3/trending/movie/day?api_key=<key>
json
{
  "page": 1,
  "results": [
    {
      "backdrop_path": "/20uHjZ4yCPD2x0ndcxZaxM7hLIy.jpg",
      "id": 493529,
      "title": "Dungeons \u0026 Dragons: Honor Among Thieves",
      "overview": "A charming thief and a band of unlikely adventurers undertake an epic heist to retrieve a lost relic, but things go dangerously awry when they run afoul of the wrong people.",
      "poster_path": "/A7AoNT06aRAc4SV89Dwxj3EYAgC.jpg",
      "popularity": 507.373,
      "release_date": "2023-03-23",
      "vote_average": 7.484,
      "vote_count": 619
    },
    {
      "backdrop_path": "/e7FzphKs5gzoghDotAEp2FeP46u.jpg",
      "id": 649609,
      "title": "Renfield",
      "overview": "Having grown sick and tired of his centuries as Dracula's lackey, Renfield finds a new lease on life — and maybe even redemption — when he falls for feisty, perennially angry traffic cop Rebecca Quincy.",
      "poster_path": "/p6yUjhvNGQpFZilKwOKbxQ1eHlo.jpg",
      "popularity": 209.828,
      "release_date": "2023-04-07",
      "vote_average": 7.208,
      "vote_count": 132
    }
  ],
  "total_pages": 1000,
  "total_results": 20000
}

Film-Suche

Die Filme können nach Namen durchsucht werden. Dabei wird der Suchbegriff als Query-Parameter query an die URL angehängt.

So z.B. die Suche nach dem Film «Titanic»

url
https://api.themoviedb.org/3/search/movie?api_key=<key>&query=Titanic

Zurück kommt eine Liste von Treffern: (verkürzt und vereinfacht)

json
{
  "page": 1,
  "results": [
    {
      "backdrop_path": "/rzdPqYx7Um4FUZeD8wpXqjAUcEm.jpg",
      "id": 597,
      "overview": "101-year-old Rose DeWitt Bukater tells the story of her life aboard the Titanic, 84 years later. A young Rose boards the ship with her mother and fiancé. Meanwhile, Jack Dawson and Fabrizio De Rossi win third-class tickets aboard the ship. Rose tells the whole story from Titanic's departure through to its death—on its first and last voyage—on April 15, 1912.",
      "popularity": 116.003,
      "poster_path": "/9xjZS2rlVxm8SFx8kPC3aIGCOYQ.jpg",
      "release_date": "1997-11-18",
      "title": "Titanic",
      "vote_average": 7.892,
      "vote_count": 22813
    },
    {
      "backdrop_path": "/3oShsRvAyZiQQ5lP2hszWN9Ri0b.jpg",
      "id": 16535,
      "overview": "Unhappily married, Julia Sturges decides to go to America with her two children on the Titanic. Her husband, Richard also arranges passage on the luxury liner so as to have custody of their two children. All this fades to insignificance once the ship hits an iceberg.",
      "popularity": 19.935,
      "poster_path": "/rEPzO9I6LCk6Mxg1X4BsBk6oA3V.jpg",
      "release_date": "1953-04-11",
      "title": "Titanic",
      "vote_average": 6.578,
      "vote_count": 102
    }
  ],
  "total_pages": 9,
  "total_results": 176
}

Serien-Suche

Die Serien können nach Namen durchsucht werden. Dabei wird der Suchbegriff als Query-Parameter query an die URL angehängt.

So z.B. die Suche nach der Serie «Lost»

url
https://api.themoviedb.org/3/search/tv?api_key=<key>&query=Lost

Zurück kommt eine Liste von Treffern: (verkürzt und vereinfacht)

json
{
  "page": 1,
  "results": [
    {
      "backdrop_path": "/jBhcm0Rm5Uv1UaHt0TTWuRjG5G3.jpg",
      "id": 4607,
      "overview": "Stripped of everything, the survivors of a horrific plane crash  must work together to stay alive. But the island holds many secrets.",
      "popularity": 162.343,
      "poster_path": "/og6S0aTZU6YUJAbqxeKjCa3kY1E.jpg",
      "first_air_date": "2004-09-22",
      "name": "Lost",
      "vote_average": 7.969,
      "vote_count": 3435
    },
    {
      "backdrop_path": "/wci4coPpl3DRnXCiLxeGD5Rc4Kc.jpg",
      "id": 61389,
      "overview": "An orphan known as Tenma becomes one of Athena's 88 warriors known as Saints and finds himself in a war fighting against his best friend Alone who is revealed to be the reincarnation of Athena's biggest enemy, the God Hades.",
      "popularity": 80.745,
      "poster_path": "/eJNAxUHVXXUSbuc6D1ojSYH6S1r.jpg",
      "first_air_date": "2009-06-24",
      "name": "Saint Seiya: The Lost Canvas",
      "vote_average": 8.203,
      "vote_count": 523
    }
  ],
  "total_pages": 17,
  "total_results": 336
}

Film-Details mit Credits

Die id des Filmes/der Serie wird wiederum hinten an den Endpoint gehängt. Zudem werden «credits» an die Ergebnisse angehängt.

url
https://api.themoviedb.org/3/movie/597?api_key=<key>&append_to_response=credits
json
{
  "backdrop_path": "/rzdPqYx7Um4FUZeD8wpXqjAUcEm.jpg",
  "budget": 200000000,
  "genres": [
    { "id": 18, "name": "Drama" },
    { "id": 10749, "name": "Romance" }
  ],
  "id": 597,
  "overview": "101-year-old Rose DeWitt Bukater tells the story of her life aboard the Titanic, 84 years later. A young Rose boards the ship with her mother and fiancé. Meanwhile, Jack Dawson and Fabrizio De Rossi win third-class tickets aboard the ship. Rose tells the whole story from Titanic's departure through to its death—on its first and last voyage—on April 15, 1912.",
  "popularity": 116.003,
  "poster_path": "/9xjZS2rlVxm8SFx8kPC3aIGCOYQ.jpg",
  "release_date": "1997-11-18",
  "revenue": 2264162353,
  "runtime": 194,
  "tagline": "Nothing on Earth could come between them.",
  "title": "Titanic",
  "vote_average": 7.892,
  "vote_count": 22813,
  "credits": {
    "cast": [
      {
        "adult": false,
        "gender": 2,
        "id": 28657,
        "known_for_department": "Acting",
        "name": "Matthew Fox",
        "original_name": "Matthew Fox",
        "popularity": 10.958,
        "profile_path": "/6VIfueb4j3GCsIhxnstsXlY5C3Y.jpg",
        "character": "Jack Shephard",
        "credit_id": "525775ad760ee36aaa5185b3",
        "order": 0
      },
      {
        "adult": false,
        "gender": 1,
        "id": 19034,
        "known_for_department": "Acting",
        "name": "Evangeline Lilly",
        "original_name": "Evangeline Lilly",
        "popularity": 47.251,
        "profile_path": "/fRbXVt9fhz6ndPhF1lRA92VxUDk.jpg",
        "character": "Kate Austen",
        "credit_id": "525775ad760ee36aaa518649",
        "order": 1
      }
    ]
  }
}

Serien-Details mit Credits

Die id des Filmes/der Serie wird wiederum hinten an den Endpoint gehängt. Zudem werden «credits» an die Ergebnisse angehängt.

url
https://api.themoviedb.org/3/tv/4607?api_key=<key>&append_to_response=credits
json
{
  "backdrop_path": "/jBhcm0Rm5Uv1UaHt0TTWuRjG5G3.jpg",
  "episode_run_time": [45],
  "first_air_date": "2004-09-22",
  "genres": [
    { "id": 9648, "name": "Mystery" },
    { "id": 10759, "name": "Action & Adventure" }
  ],
  "id": 4607,
  "name": "Lost",
  "number_of_episodes": 118,
  "number_of_seasons": 6,
  "overview": "Stripped of everything, the survivors of a horrific plane crash  must work together to stay alive. But the island holds many secrets.",
  "popularity": 162.343,
  "poster_path": "/og6S0aTZU6YUJAbqxeKjCa3kY1E.jpg",
  "seasons": [
    {
      "air_date": "2004-09-22",
      "episode_count": 24,
      "id": 14041,
      "name": "Season 1",
      "overview": "Mysteries abound on the first season of LOST as the survivors of Oceanic Air flight 815 find themselves stranded on an unidentified island with little hope of rescue.",
      "poster_path": "/fc9f4ERC09U1GziCgDWilWWgjKx.jpg",
      "season_number": 1
    },
    {
      "air_date": "2005-09-21",
      "episode_count": 24,
      "id": 14042,
      "name": "Season 2",
      "overview": "The motley crew of castaways remains stranded on the eerie deserted island populated by mysterious things that go bump in the night.",
      "poster_path": "/vGLddXoXJhKPsAWeDYbAsE4wW1z.jpg",
      "season_number": 2
    }
  ],
  "tagline": "Everything happens for a reason.",
  "type": "Scripted",
  "vote_average": 7.969,
  "vote_count": 3435,
  "credits": {
    "cast": [
      {
        "id": 28657,
        "known_for_department": "Acting",
        "name": "Matthew Fox",
        "popularity": 10.958,
        "profile_path": "/6VIfueb4j3GCsIhxnstsXlY5C3Y.jpg",
        "character": "Jack Shephard"
      },
      {
        "id": 19034,
        "known_for_department": "Acting",
        "name": "Evangeline Lilly",
        "popularity": 47.251,
        "profile_path": "/fRbXVt9fhz6ndPhF1lRA92VxUDk.jpg",
        "character": "Kate Austen"
      }
    ]
  }
}

Actor-Details mit Credits

Die id des Actors wird hinten an den Endpoint gehängt. Zudem werden «movie_credits» an die Ergebnisse angehängt. (geht auch mit «tv_credits» oder «combined_credits»)

url
https://api.themoviedb.org/3/person/6193?api_key=<key<&append_to_response=movie_credits
json
{
  "biography": "Leonardo Wilhelm DiCaprio (born November 11, 1974) is an American actor and film producer. Known for his work in biopics and period films, DiCaprio is the recipient of numerous accolades, including an Academy Award, a British Academy Film Award, and three Golden Globe Awards. As of 2019, his films have grossed over $7.2 billion worldwide, and he has been placed eight times in annual rankings of the world's highest-paid actors.\n\nBorn in Los Angeles, DiCaprio began his career in the late 1980s by appearing in television commercials. In the early 1990s, he had recurring roles in various television shows, such as the sitcom Parenthood, and had his first major film part as author Tobias Wolff in This Boy's Life (1993). At age 19, he received critical acclaim and his first Academy Award and Golden Globe Award nominations for his performance as a developmentally disabled boy in What's Eating Gilbert Grape (1993). He achieved international stardom with the star-crossed romances Romeo + Juliet (1996) and Titanic (1997).\n\nAfter the latter became the highest-grossing film at the time, he reduced his workload for a few years. In an attempt to shed his image of a romantic hero, DiCaprio sought roles in other genres, including crime drama in Catch Me If You Can (2002) and Gangs of New York (2002); the latter marked the first of his many successful collaborations with director Martin Scorsese. DiCaprio portrayed Howard Hughes in The Aviator (2004) and received acclaim for his performances in the political thriller Blood Diamond (2006), the crime drama The Departed (2006), and the romantic drama Revolutionary Road (2008).\n\nIn the following decade, DiCaprio starred in several high-profile directors' projects, including the science fiction thriller Inception (2010), the western Django Unchained (2012), the biopic The Wolf of Wall Street (2013), the survival drama The Revenant (2015), for which he won an Academy Award and a BAFTA Award for Best Actor in a Leading Role, and the comedy-drama Once Upon a Time in Hollywood (2019), all of which were critical and commercial successes.\n\nDiCaprio is the founder of Appian Way Productions, a production company that has produced some of his films and the documentary series Greensburg (2008–2010), and the Leonardo DiCaprio Foundation, a nonprofit organization devoted to promoting environmental awareness. He regularly supports charitable causes and has produced several documentaries on the environment. In 2005, he was named a Commander of the Ordre des Arts et des Lettres for his contributions to the arts, and in 2016, he appeared in Time magazine's 100 most influential people in the world.",
  "birthday": "1974-11-11",
  "deathday": null,
  "id": 6193,
  "known_for_department": "Acting",
  "name": "Leonardo DiCaprio",
  "place_of_birth": "Los Angeles, California, USA",
  "popularity": 55.49,
  "profile_path": "/wo2hJpn04vbtmh0B9utCFdsQhxM.jpg",
  "movie_credits": {
    "cast": [
      {
        "backdrop_path": "/m0miV65ZZIp13TNHJSRUF6vmCos.jpg",
        "id": 454,
        "overview": "In director Baz Luhrmann's contemporary take on William Shakespeare's classic tragedy, the Montagues and Capulets have moved their ongoing feud to the sweltering suburb of Verona Beach, where Romeo and Juliet fall in love and secretly wed. Though the film is visually modern, the bard's dialogue remains.",
        "popularity": 23.097,
        "poster_path": "/eLf4jclPijOqfEp6bDAmezRFxk5.jpg",
        "release_date": "1996-11-01",
        "title": "Romeo + Juliet",
        "vote_average": 6.8,
        "vote_count": 4550,
        "character": "Romeo"
      },
      {
        "backdrop_path": "/rzdPqYx7Um4FUZeD8wpXqjAUcEm.jpg",
        "id": 597,
        "overview": "101-year-old Rose DeWitt Bukater tells the story of her life aboard the Titanic, 84 years later. A young Rose boards the ship with her mother and fiancé. Meanwhile, Jack Dawson and Fabrizio De Rossi win third-class tickets aboard the ship. Rose tells the whole story from Titanic's departure through to its death—on its first and last voyage—on April 15, 1912.",
        "popularity": 116.003,
        "poster_path": "/9xjZS2rlVxm8SFx8kPC3aIGCOYQ.jpg",
        "release_date": "1997-11-18",
        "title": "Titanic",
        "vote_average": 7.892,
        "vote_count": 22813,
        "character": "Jack Dawson"
      }
    ]
  }
}

Bilder

Mit den Bilddateinamen aus den Suchergebnissen lassen sich Bilder anzeigen. Allerdings muss man den Pfad entsprechend ergänzen. Dazu liefert der Endpoint config die verfügbaren Bild-Grössen und die Grund-URL:

json
{
  "images": {
    "base_url": "http://image.tmdb.org/t/p/",
    "secure_base_url": "https://image.tmdb.org/t/p/",
    "backdrop_sizes": ["w300", "w780", "w1280", "original"],
    "logo_sizes": ["w45", "w92", "w154", "w185", "w300", "w500", "original"],
    "poster_sizes": ["w92", "w154", "w185", "w342", "w500", "w780", "original"],
    "profile_sizes": ["w45", "w185", "h632", "original"],
    "still_sizes": ["w92", "w185", "w300", "original"]
  }
}

So lassen sich Bild-URLs aus secure_base_url, einer Grösse aus der entsprechenden Liste und dem Dateinamen zusammensetzen.

Poster

html
<img src="https://image.tmdb.org/t/p/w154/9xjZS2rlVxm8SFx8kPC3aIGCOYQ.jpg" alt="poster" />
poster

Backdrops

html
<img src="https://image.tmdb.org/t/p/original/jBhcm0Rm5Uv1UaHt0TTWuRjG5G3.jpg" alt="backdrop" />
backdrop

Actors

html
<img src="https://image.tmdb.org/t/p/w185/wo2hJpn04vbtmh0B9utCFdsQhxM.jpg" alt="profile_path" />
profile_path

Gymnasium Kirchenfeld, fts & lem