I'm trying to use the Discover API. I know my API-Key is valid since the following works:
https://api.themoviedb.org/3/discover/movie?api_key=
But as soon as I start adding parameters, it fails ({"status_code":7,"status_message":"Invalid API key: You must be granted a valid key.","success":false}). When I use the "try it" with the parameters I really want to use, it works, but when I tried copying that URL and adjusting it to use my API-Key, I can't get it to work. For reference, the following are the parameters I really want to specify:
?include_adult=false ?include_video=false ?language=en-US ?primary_release_year=2023 ?with_genres=28|12|80|18|36|27|9648|878|53|10752 ?with_original_language=en
Here's the full URL as I built it with the parameters above:
https://api.themoviedb.org/3/discover/movie?api_key=?include_adult=false?include_video=false?language=en-US?page=1?primary_release_year=2023?with_genres=28|12|80|18|36|27|9648|878|53|10752?with_original_language=en
Can someone shed some light on this for please? I'm sure it's something simple that I'm just not used to (I'm a retired IT Nerd that spent a lot of years programming, but not in the web world). For example, are there mutually-exclusive parameters that I can't use together (I don't think so, but am obviously grasping) or are the parameters required to be specified in a specific sequence, etc?
Thanks, Mark
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 Travis Bell
on January 22, 2024 at 12:37 AM
You need to start HTTP parameters with a question mark
?
but append them with an ampersand&
.Reply by Mark Stepan
on January 22, 2024 at 8:41 AM
OMG, I feel bad for even bothering you with that question, but THANK YOU Travis. Geez. It appears that the FINAL "&" is optional (in the browser it seems to be OK with or without it).
Of course, I used to have a little laminating saying by my desk while I was still working: "The only DUMB QUESTION is the one not asked."
Thanks again! I'm successfully calling web services now and it's working like a charm. Keep up the good work (site)!!!