The Movie Database támogatás

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 válasz érkezett (1 / 1 oldalból)

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.

Nem találsz egy filmet vagy egy sorozatot? Jelentkezz be és hozd létre.

Globális

s focus the search bar
p profil menü megnyitása
esc close an open window
? billentyűparancsok ablak megnyitása

Minden média oldalon

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

On TV season pages

(jobbra nyíl) ugrás a következő évadra
(balra nyíl) vissza az előző évadra

Tévéepizód oldalakon

(jobbra nyíl) ugrás a következő részre
(balra nyíl) vissza az előző részre

Minden kép oldalon

a kép hozzáadása ablak megnyitása

Minden szerkesztő oldalon

t fordítás választó megnyitása
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 ugrás az utolsó válaszhoz
ctrl+ enter submit your message
(jobbra nyíl) következő oldal
(balra nyíl) előző oldal

Beállítások

Want to rate or add this item to a list?

Bejelentkezés