Assistance de TMDB

Hello, i'm trying to use this java wrapper:

https://github.com/holgerbrandl/themoviedbapi/

I added dependencies to my project so i can compile now.

Then they say:

To get started you need a TMdB API key. With this you can instantiate info.movito.themoviedbapi.TmdbApi, which has getters for all subcategories of the API. For instance to get a movie by ID, do the following:

TmdbMovies movies = new TmdbApi("apikey").getMovies();
MovieDb movie = movies.getMovie(5353, "en");

So i went in TmdbApi.java and did this in the main:

public static void main(String[] args)

{

    String apiKey = System.getenv("apiKey");
    TmdbApi tmdbApi = new TmdbApi("#########################"); // my valid key.
    TmdbMovies movies = tmdbApi.getMovies();
    MovieDb movie = movies.getMovie(5353, "en");

}

But then it throws me this:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

SLF4J: Defaulting to no-operation (NOP) logger implementation

SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Exception in thread "main" ResponseStatus{code=7, message=Invalid API key: You must be granted a valid key.}

at info.movito.themoviedbapi.AbstractTmdbApi.mapJsonResult(AbstractTmdbApi.java:78)
at info.movito.themoviedbapi.AbstractTmdbApi.mapJsonResult(AbstractTmdbApi.java:45)
at info.movito.themoviedbapi.AbstractTmdbApi.mapJsonResult(AbstractTmdbApi.java:40)
at info.movito.themoviedbapi.TmdbConfig.getConfig(TmdbConfig.java:18)
at info.movito.themoviedbapi.TmdbApi.<init>(TmdbApi.java:51)
at info.movito.themoviedbapi.TmdbApi.<init>(TmdbApi.java:41)
at info.movito.themoviedbapi.TmdbApi.main(TmdbApi.java:232)

And i have no idea why since my api key is valid i tested it before and after!

So if anyone could help me on this one i would be really grateful.

Thank you, sorry for my english. :)

4 réponses (sur la page 1 sur 1)

Jump to last post

Happy to hear you sorted it out!

Hi,

Could you please tell me if and how you sorted it out . I have exactly the same issue !

Thx in advance

up

For those encountering the problem try: https://www.themoviedb.org/talk/5885f724c3a3684d66008671

Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.

Général

s Mettre le curseur dans la barre de recherche
p Ouvrir le menu du profil
esc Fermer une fenêtre ouverte
? Ouvrir la fenêtre des raccourcis clavier

Sur les pages des médias

b Retour (ou vers le parent si faisable)
e Afficher la page de modification

Sur les pages des saisons des émissions télévisées

Afficher la saison suivante (flèche droite)
Afficher la saison précédente (flèche gauche)

Sur les pages des épisodes des émissions télévisées

Afficher l'épisode suivant (flèche droite)
Afficher l'épisode précédent (flèche gauche)

Sur toutes les pages des images / photos

a Ouvrir la fenêtre d'ajout d'image / photo

Sur toutes les pages de modifications

t Ouvrir le sélecteur de traduction
ctrl+ s Envoyer le formulaire

Sur les pages des discussions

n Créer une nouvelle discussion
w Basculer le statut de suivi
p Basculer publique / privée
c Basculer fermer / ouvrir
a Ouvrir l'activité
r Répondre à la discussion
l Afficher la dernière réponse
ctrl+ enter Envoyer votre message
Page suivante (flèche droite)
Page précédente (flèche gauche)

Paramètres

Vous souhaitez évaluer ou ajouter cet élément à une liste ?

Connexion