Supporto The Movie Database

I'm using Android, so I can't exactly copy the entire URL string that I'm using, but I'm using:

mClient = new AsyncHttpClient();
mParams = new RequestParams();

        mParams.put(page.toString(), "page"); // where page is an integer that starts at 1, in this case, it's 1
        mParams.put("myApiKey", "api_key");
        String requestUrl = baseUrl + nowPlaying;
        Toast.makeText(mContext, requestUrl, Toast.LENGTH_LONG).show();
        Log.d("TAG", requestUrl);
        mClient.get(baseUrl + nowPlaying, mParams, new JsonHttpResponseHandler() {
  @Override
            public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
               try {
                   JSONArray moviesJson = response.getJSONArray("results");
                   String jsonString = moviesJson.toString();
                   Toast.makeText(mContext, jsonString, Toast.LENGTH_LONG).show();
                   mMovies = Movie.fromJson(moviesJson);
               } catch (JSONException e) {
                   e.printStackTrace();
               }
           }

           @Override
           public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject jsonObject) {
               Log.d("Failed: ", ""+statusCode);
               Log.d("Error : ", "" + throwable);
           }

In LogCat, I'm getting a 401 error... If you check my account, you'll see what my API key is, so I"m wondering why it's autofailing. I tried using CocoaRest Client with api_key, page as correct parameters and i'm still getting a 401.

2 risposte (nella pagina 1 di 1)

Jump to last post

You can mark this solved, I'm dumb.
For those curious: if you're doing TMDB to try out Android versus iOS, make sure you put parameters as key first, then value.

Noted! Thanks for the followup.

Non riesci a trovare un film o una serie Tv? Accedi per crearlo.

Globale

s focalizza la barra di ricerca
p apri menu profilo
esc chiudi una finestra aperta
? apri finestra scorciatoia tastiera

Su tutte le pagine di media

b torna indietro (o al precedente quando applicabile)
e vai alla pagina di modifica

Nelle pagine delle stagioni TV

(freccia destra) vai alla stagione successiva
(freccia sinistra) vai alla stagione precedente

Nelle pagine degli episodi TV

(freccia destra) vai all'episodio successivo
(freccia sinistra) vai all'episodio precedente

Su tutte le pagine di immagini

a apri finestra aggiungi immagine

Su tutte le pagine di modifica

t apri selettore traduzione
ctrl+ s invia modulo

Sulle pagine di discussione

n crea nuova discussione
w segna come visto/non visto
p cambia publico/privato
c cambia chiuso/aperto
a apri attivita
r rispondi alla discussione
l vai all'ultima risposta
ctrl+ enter invia il tuo messaggio
(freccia destra) pagina successiva
(freccia sinistra) pagina precedente

Impostazioni

Vuoi valutare o aggiungere quest'elemento a una lista?

Accedi