Sprijin Bază de date filme (The Movie Database)

Hi all,

I'm just learning how to use API's & I'm trying to make a simple app that returns the poster image from a user search for a movie. But I keep getting a 403 error message when I try to run the api call, here is the my code:

$.getJSON("http://themoviedb.apiary.io/3/search/movie?query=" + film + "?api_key=XXXXXXX?callback=?", function(json){ .....}); where film = the user input value (ie the movie searching for)

Can someone shwo me what I'm doing wrong please?

4 răspunsuri (pe pagina 1 din 1)

Jump to last post

Hi smathew322,

2 things. Just double checking and making sure that for "real world" requests you use our production API and not Apiary.

You're not setting the second (and third) HTTP parameters properly. You'll want to switch them to an ampersand.

$.getJSON("http://themoviedb.apiary.io/3/search/movie?query=" + film + "&api_key=###&callback=###", function(json){ .....});

Cheers.

Hi Travis,

Thanks a lot fo the help! I made the changes as well as use the production API now and it works. But in order for me to get the image, it looks like I need to use the "Configuration" method to get the base url. Do I have to make a separate API call for this? Not really sure how to use this.

The typical pattern I recommend is to request it once a month and cache it. By checking once a month you can double check you're still using the valid image URL. We have changed it before and you want to make sure your images don't stop working.

Thanks so much, Travis!!! Your responses helped me a lot to complete the tutorial.

Nu găsiți un film sau un serial? Autentificați-vă pentru a-l crea.

Globale

s focalizează bara de căutare
p deschide meniul profilului
esc închide o fereastră deschisă
? deschide fereastra cu scurtături de la tastatură

Pe paginile media

b mergi înapoi (sau la părinte atunci când este cazul)
e mergi la pagina de editare

Pe paginile sezoanelor filmelor seriale

(săgeată dreapta) mergi la sezonul următor
(săgeată stânga) mergi la sezonul precedent

Pe paginile episoadelor filmelor seriale

(săgeată dreapta) mergi la episodul următor
(săgeată stânga) mergi la episodul precedent

Pe toate paginile de imagini

a deschide fereastra pentru adăugarea de imagini

Pe toate paginile de editare

t deschide selectorul de traduceri
ctrl+ s trimite formularul

Pe paginile de discuții

n crează o discuție nouă
w comută starea de vizionare
p comută publică/privată
c comută închisă/deschisă
a deschide activitatea
r răspunde la discuție
l mergi la ultimul răspuns
ctrl+ enter trimite mesajul
(săgeată dreapta) pagina următoare
(săgeată stânga) pagina precedentă

Setări

Doriți să evaluați sau să adăugați acest articol într-o listă?

Autentificare