The Movie Database Support

Hello, hope everyone is doing great!

I'm using this URL to get the details of a movie

`${API_URL}movie/${movieId}?api_key=${API_KEY}`;

for example

https://api.themoviedb.org/3/movie/524434?api_key=###########;

then I'm trying to console log the movie object but I get undefined, and this error

https://api.themoviedb.org/3/movie/[object%20Object]?api_key=###### 404

{"success":false,"status_code":34,"status_message":"The resource you requested could not be found."}

P.S: I'm using the database also to get the list of movies and it works very well!

I'm using this in a ReactJS project

4 replies (on page 1 of 1)

Jump to last post

@bash95 said:
404 when trying to get a movie details
Hello, hope everyone is doing great!
I'm using this URL to get the details of a movie

`${API_URL}movie/${movieId}?api_key=${API_KEY}`;

for example

https://api.themoviedb.org/3/movie/524434?api_key=###########;  

then I'm trying to console log the movie object
but I get undefined, and this error
https://api.themoviedb.org/3/movie/[object%20Object]?api_key=###### 404
{"success":false,"status_code":34,"status_message":"The resource you requested could not be found."}

P.S: I'm using the database also to get the list of movies and it works very well!
I'm using this in a ReactJS project

You gave an example.
https://api.themoviedb.org/3/movie/524434?api_key=THE_KEY
When I make the API Request using my browser the response is correct.
When you make the same API Request using your programming code in ReactJS you get 404 error response.
My conclusion is that there is some error in your programming code.
And it must be one of those tiny little mistakes, like an extra comma.
And this error is probably in the movie ID.
I say this because the error says it didn't find the resource.

... movie/ [object%20Object] ?api_key=

Probably only ReactJS users can help you.
I will add ReactJS to your title of this conversation.
ReactJS - 404 when trying to get a movie details

Thank you a lot ticao2 šŸ‡§šŸ‡· pt-BR

Yeah exactly! I noticed the URL

... movie/ [object%20Object] ?api_key=

I tried to print the movieId, and it's correct

Thanks again for your priceless help, I'll be waiting for other responses

I know where's my mistake I wrote

const movieId = useParams();

instead of

const {movieId} = useParams();

now it's working!

So, I don't know how or whether I can close this discussion XD

:-)

Can't find a movie or TV show? Login to create it.

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Settings

Want to rate or add this item to a list?

Login