Assistance de TMDB

My code to create a list for a user is not working. To confirm my understanding of the code, I tried sending the request using curl and am getting the same response as my code: 500 Internal Server Error. Here's my curl command:

curl -i -X POST 'https://api.themoviedb.org/3/list?api_key=my_api_key&session_id=my_session_id -d 'name=fred&description=flintstone'

Perhaps you can tell me why this command doesn't work. BTW, if I use a bad my_api_key, it gives me an Invalid API key error. If I use a bad my_session_id, it gives me an Authentication failed error. If I omit one or both of the name or description parameters, it gives me an Invalid parameters error. Only if I include all the correct parameters and the name and description payload body does it give me the 500 Internal Server Error.

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

Jump to last post

Hi celiao,

You need to pass the name and description in as valid JSON. There's a cURL example in the docs:

curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --header "Accept: application/json" \
     --data-binary '{
    "name": "My Totally Awesome List",
    "description": "This list was created to share all of the totally awesome movies I\'ve seen."
}' \
     http://api.themoviedb.org/3/list

Cheers.

Previously, I also tried passing the name and description as JSON and received a 500 Internal Server Error:

curl -i -X POST 'https://api.themoviedb.org/3/list?api_key=my_api_key&session_id=my_session_id' \
     -d '{"name": "fred", "description": "flintstone"}' \
     -H 'Content-Type: application/json' -H 'Accept: application/json'

So, I tried using the format in the cURL example:

curl --include --request POST \
     --header "Content-Type: application/json" --header "Accept: application/json" \
     --data-binary '{"name": "fred", "description": "flintstone"}' \
     'https://api.themoviedb.org/3/list?api_key=my_api_key&session_id=my_session_id'

This also produces a 500 Internal Server Error.

I am able to make other POST request calls, with parameters and payloads, with my code and with cURL, without errors. Only this list creation method is giving me trouble. Any more clues? Thanks.

Would you mind looking at this issue again? Please take a look at my curl command and see if you can figure out what I'm doing incorrectly. Thanks!

Now, for some reason, I'm getting an HTTP 404 Not Found error and status code of 34, which is not on the list of status codes: https://www.themoviedb.org/documentation/api/status-codes.

curl -i -X POST -H "Content-Type: application/json" -H "Accept: application/json" \
        -d '{"name": "My totally awesome list", "description": "this would be awesome if it worked"}' \
        'http://api.themoviedb.org/3/list/?api_key=MY_API_KEY&session_id=MY_SESSION_ID'

HTTP/1.1 404 Not Found
Access-Control-Allow-Origin: *
Cache-Control: public, max-age=36000
Content-Type: application/json;charset=utf-8
Date: Sat, 12 Jul 2014 01:20:30 GMT
Server: nginx
Status: 404 Not Found
X-Cascade: pass
Content-Length: 80
Connection: keep-alive

{"status_code":34,"status_message":"The resource you requested could be found."}

Any clues that help me get this working would be appreciated.

Hi celiao,

34 was recently added, it’s just the status code for a 404 when the controller action doesn’t exist (I’ll have to update the website docs).

This particular issue is the trailing / you have at the of your URL.

curl -i -X POST -H "Content-Type: application/json" -H "Accept: application/json" \
        -d '{"name": "My totally awesome list", "description": "this would be awesome if it worked"}' \
        'http://api.themoviedb.org/3/list?api_key=MY_API_KEY&session_id=MY_SESSION_ID'

Fixes that.

I am seeing a 500 error though, and will take a look at this when I get back into the office on Monday. I’ve created a ticket for this issue here.

Makes sense. I was receiving a 500 error with my Python code too, so it would be great to get this resolved.

In addition, you might want to add not to the error message:

{"status_code": 34, "status_message": "The resource you requested could not be found."}

Just wanted to chime in and report that this still seems to be an issue.

We're issuing a:

http://api.themoviedb.org/3/list?session_id={session}&api_key={key}
{"name":"test","description":"test"}

And get back:

HTTP 500
{"status_code":11,"status_message":"Internal error: Something went wrong, contact TMDb."}

Hey Mike,

Yup, ticket for this is here: http://tmdb.lighthouseapp.com/projects/83077/tickets/405-creating-new-lists-seems-to-fail-when-it-should-work

It's close to (finally) being the next thing I look at.

Hey guys,

Lists should be create able again. Can you let me know how you make out?

Fantastic, Travis!

tmdbsimple now passes all it's tests under Python 2.7.6, 3.3.5, and 3.4.0.

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