The Movie Database-ondersteuning

A few months ago I had successfully requested API with appending account_id but now I forgot the way to get account_id.

2 antwoorden (op pagina 1 van 1)

Jump to last post

You will get the account id from completing a /auth/access_token request. You can check out the example response.

@travisbell said:

You will get the account id from completing a /auth/access_token request. You can check out the example response.

{
**  "account_id": "4bc8892a017a3c0z92001001",**
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCIdIkpXVCJ9.eyJuYmYiOjE0ODM1NzM4MzUsInZlcnNpb24iOjEsInN1YiI6IjRiYzg4OTJhMDE3YTNjMGY5MjAwMDAwMiIsImF1ZCI6IlNmODc4NTdiZTIwOWQzNTE5ODMzYjMwMGExM2QwZTEyIiwic2NvcGVzIjpbImFwaV9yZWFkIiwiYXBpX3dyaXRlIl0sImp0aSI6Ijg4In0.b76OiEs10gdp9oNOoGpBJ94nO9Zi17Y7SvAXJQW8nH2",
  "success": true,
  "status_message": "Success.",
  "status_code": 1
}

These account_id is really account_object_id used in some endpoints in API v4. The account_id is an Int, not a String:

{
  "avatar": {
    "gravatar": {
      "hash": "c9e9fc152ee756a900db85757c29815d"
    },
    "tmdb": {
      "avatar_path": "/xy44UvpbTgzs9kWmp4C3fEaCl5h.png"
    }
  },
**  "id": 548,**
  "iso_639_1": "en",
  "iso_3166_1": "CA",
  "name": "Travis Bell",
  "include_adult": false,
  "username": "travisbell"
}

This number is required aparently in some methods like https://api.themoviedb.org/3/account/{account_id} If you try this endpoint in API documentation and delete the required account_id path param you obtain a succesful response. I don't know if is an error or the endpoint obtains the usser account acroos the ACCES_TOKEN_AUTH.

These is my solution in Kotlin:

val request = Request.Builder()
                .url("https://api.themoviedb.org/3/account/account_id?session_id=${Constants.SESSION_ID_v3}")
                .get()
                .addHeader("accept", "application/json")
                .addHeader("Authorization", "Bearer ${Constants.ACCES_TOKEN_AUTH}")
                .build()

Film of tv-serie niet gevonden? Meld je aan om deze toe te voegen.

Wereldwijd

s focus op zoekbalk
p open profielmenu
esc sluit een open venster
? open sneltoetsen venster

Op media pagina's

b ga terug (of ga naar bovenliggend item)
e ga naar beweken

Op tv-seizoenspagina's

(rechter pijl) ga naar volgende seizoen
(linker pijl) ga naar vorig seizoen

Op pagina's met tv-series

(rechter pijl) ga naar volgende aflevering
(linker pijl) ga naar vorige aflevering

Op alle afbeeldingspagina's

a open venster afbeelding toevoegen

Op alle bewerkte pagina's

t open vertaalmenu
ctrl+ s verstuur formulier

Op discussiepagina's

n start nieuwe discussie
w Verander kijk status
p privé of openbaar
c schakelen sluiten/openen
a open activiteit
r beantwoord discussie
l ga naar laatste antwoord
ctrl+ enter verstuur uw bericht
(rechter pijl) volgende pagina
(linker pijl) vorige pagina

Instellingen

Want to rate or add this item to a list?

Inloggen