I have the movie ID, tried to do themoviedb.org/ {id} doesn't exist, i tried using themoviedb.org/tv/ {id} and got the right page. But then i realize some need to use themoviedb.org/movie/ {id} to get the right page.
is there any way to get the right URL redirecting to tmdb?
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by ticao2 š§š· pt-BR
on December 16, 2020 at 8:00 AM
There are no two Movies with the same ID.
But there may be a TV Show with the same ID. Or a person.
The list of IDs are separate, different for each type (movie, tv, person, network and company).
So, for each type you must use the corresponding Base URL.
For example, ID 500:
Reply by CahyoNurHikari
on December 16, 2020 at 10:54 AM
is there any way to get base url (the /movie/ or /tv/) from the API?
Reply by Travis Bell
on December 16, 2020 at 11:15 AM
Hi @CahyoNurHikari, no. They are static, and since you know what item you're requesting you can map them client side.
Reply by Skorpjun
on February 21, 2023 at 2:44 PM
Hi, I would like to know if there is currently a way to get the TMDB URL from the TMDB ID. I read the posts above, but what do you mean 'map them client side'? How is there a way to know the URL client side if the 'GET /movie/{movie_id} ' command does not return any info on whether it is a movie or a TV show, while TMDB URL's differentiate between movies and TV shows? Thnx
Reply by ticao2 š§š· pt-BR
on February 21, 2023 at 5:17 PM
If you only know the TMDb ID but don't know what type of item it belongs to, then NO.
Just testing all possible URLs.
But, if you received that ID in an API Request response then YES.
Every response contains in each item in addition to the ID also more data including the type of item.
Movie, TV, Person, Network or Company.
If you post here an API Request you made, and you can't find that information, it will be easier to explain where the data is.
Reply by Skorpjun
on February 22, 2023 at 11:20 AM
Hi ticao2, Imagine an API movie search request using "api.themoviedb.org/3/search/movie?query=TITLE". The JSON result would contains a lot of things, but as far as I could find no information about the type (Movie, TV, etc). See https://developers.themoviedb.org/3/search/search-movies Thnx
Reply by Travis Bell
on February 22, 2023 at 11:37 AM
Hi @Skorpjun, if you're making a request to
/search/movie
you know you're only going to get movies back. This is the same for all searches to individual media types. If you decide to use/search/multi
however, you'll see themedia_type
field returned.