Hello trying to access the api and I keep gettting a error like below:
Fatal error: Uncaught exception 'TMDbException' with message 'Server error on "http://api.themoviedb.org/3/movie//trailers?api_key=APIKEY&language=en": HTTP/1.1 503 Service Unavailable Age: 0 Content-Type: text/html; charset=utf-8 Date: Sat, 23 Feb 2013 20:00:09 GMT Retry-After: 0 Server: nginx Via: 1.1 varnish X-Cache: MISS X-Varnish: 642980785 X-Varnish-Sid: tm-v-p-1100 Content-Length: 418 Connection: keep-alive Error 503 Service Unavailable
Service Unavailable
Guru Meditation:
XID: 642980785
Varnish cache server
' in /var/www/master/TMDb2.php:870 Stack trace: #0 /var/www/master/TMDb2.php(243): TMDb->_makeCall('movie//trailers', Array) #1 /var/www/master/cache_image-trail in /var/www/master/TMDb2.php on line 870
Any information you can provided would be most appreciated.
Thanks
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by Travis Bell
on February 24, 2013 at 10:37 AM
Hi Dale,
There haven't been any reported issues with any other users nor our external monitoring which makes me think you might be tripping the request rate limiting. You can read about it here:
http://help.themoviedb.org/kb/general/api-request-limits
Reply by Dale
on February 24, 2013 at 4:33 PM
Hello Travis,
Thank for getting back to me. OK this might explain the issue.
I will put some code into count the requests and see if I'm hitting this.
Thanks.
Dale
Reply by Dale
on March 2, 2013 at 4:43 PM
Hello Travis,
I have put a cap on the requests to 10 every 10 seconds and I am still getting the error message.
Could I work with you in private message to see if It is something I am doing wrong.
Thanks,
Dale.
Reply by frankglaser
on March 19, 2013 at 3:14 AM
Hello,
I pay attention to the request limit and run into the same problem. Any solution?
Thanks Frank
Reply by Travis Bell
on March 19, 2013 at 10:55 AM
Hi Frank/Dale,
There are no reported issues with the API.
What are the requests you are making that throw the error?
I feel fairly confident that it pretty much has to be the rate limiting. Try limiting it more. It's not just "10 requests per second" it's "30 requests every 10 seconds", so you can burst to 30. If you use up those 30 before 10 seconds is up you will get an error until 10 seconds has passed which will reset the request counter.
Reply by frankglaser
on March 19, 2013 at 11:55 AM
Hi Travis,
I limited the requests down to 20 requests every 12 seconds and printed the timestamps of the last requests to check it myself and the limit was not exceeded. The requests are done with a PHP script using curl. It utilizes several API functions: getMovie, getMovieTranslations, getMovieCast, getMovieTitles
I will check if it is always the same function which will return the error.
Reply by Travis Bell
on March 19, 2013 at 12:13 PM
Ok, let me know.
P.S. Just in case you are indeed still using 2.1 (based on those method names…), 2.1 was deprecated over a year ago and will be on the chopping block soon. If you are developing an application now, it's a waste of your time to use anything but v3.
Reply by frankglaser
on March 19, 2013 at 12:35 PM
No, it is based on V3, I've just copied the function names.
Actually I'm extending the PHP wrapper https://github.com/glamorous/TMDb-PHP-API to take care on the request limits. When it is working I will send it back to the developer.
Here are the results of the log files:
The Header is always:
The Content / Body is always:
Here the timestamps of the 20 requests per 12 seconds:
Reply by Travis Bell
on March 20, 2013 at 3:57 PM
Hey Frank,
Mind privately emailing me your IP? I'm working with out ops guy to understand what's happening here and we can have a better insight with the IP that you're using. You can email me personally at travis [at] themoviedb.org
Also, are you hitting our production API directly (api.themoviedb.org) or are you going through Apiary?
Reply by Travis Bell
on March 21, 2013 at 11:30 AM
Hey guys,
I think we've tracked this down. It is indeed a load issue that we will have to address on our side. We're looking into it and will update this thread once we've attempted to fix it. Thanks for finding this and also providing so much detail. Very helpful.
Reply by Travis Bell
on March 21, 2013 at 3:50 PM
There's still some work to be done but can you give your script a try and see how you make out? We did make one change that we're hoping will help until we address another larger issue.
P.S. the limiting is slightly different than I explained earlier. This didn't change, I was simply wrong with the original information.
We limit the requests to 4 requests per second with an allowable burst of 40. We restrict your connections to 8 allowed per IP.
UPDATE @ 2:02 PM MST I'm pretty sure our little gap measure has no effect. I'll update you guys once the proper fix has gone been pushed live.
Reply by Dale
on March 21, 2013 at 5:09 PM
Thank you frankglaser for helping proving it wasn't me going made.
Big thanks to Travis to looking into it in more detail. I currently do not have the script running as my servers are down for maintenance.
If the maintenance is finished tomorrow I will start one and see what happens.
Just want to be clear with the limits. If i have a loop that is using your site and requesting 10 movies every 10 seconds i shouldn't hit the request limit.
thanks
Dale.
Reply by frankglaser
on March 22, 2013 at 4:32 AM
Thanks for Your support Travis. I have adapted the script to handle 4 requests per second and just started it.
Can You explain, how the bursts are handled. For e.g. is one burst allowed per hour?
Reply by Carlo
on March 22, 2013 at 7:11 AM
I'm getting the 503 error as well, but I'm pretty sure the script isn't tripping the request limits. Sometimes with the "Guru Meditation: XID: xxxxxx" message below it, sometimes without.
Reply by frankglaser
on March 22, 2013 at 7:46 AM
I tried it a few times and still getting the 503 errors.
Here are the timestamps of the 4 requests per 1 second tests:
Because of the timestamps, it doesn't look like the script reaches the request limitation.
Is there any way to differ between the connection and request limit?