
I can't access the api on my server. it was working until last week. what can I do?
I can't access the api on my server. it was working until last week. what can I do?
Do you mean you can't access it at all or it sometimes returns a 429 error?
If the first then please post the URL you're trying to get.
If the second then that's due to rate limiting; if you only rarely get the 429 error then just set a delay for a few seconds before trying again.
However, if you're frequently getting the 429 error then that indicates that there's something fundamentally wrong with how you're using the API and you should read through all of the endpoints to see what would minimise the number of requests.
gazza911 wrote:
Do you mean you can't access it at all or it sometimes returns a 429 error?
If the first then please post the URL you're trying to get.
If the second then that's due to rate limiting; if you only rarely get the 429 error then just set a delay for a few seconds before trying again.
However, if you're frequently getting the 429 error then that indicates that there's something fundamentally wrong with how you're using the API and you should read through all of the endpoints to see what would minimise the number of requests.
this link works great. http://api.tvmaze.com/shows/:id
anything else (like http://api.tvmaze.com/shows?page=1, http://api.tvmaze.com/updates/shows), returns nothing (http_code=0, not 429) and timeout after 120 seconds
We had an extensive migration last weekend, but I'm pretty sure everything's functioning normally. Make sure to check that you didn't hardcode any IP addresses in your client or firewall, for example.
david wrote:
We had an extensive migration last weekend, but I'm pretty sure everything's functioning normally. Make sure to check that you didn't hardcode any IP addresses in your client or firewall, for example.
I didn't know the rate limit. I may have made too many requests. Could my server be blocked for this?
No, the rate limiting is just temporary, it'll reset after 10 seconds. If you don't receive a reply at all, it's very likely the problem is at your end.
david wrote:
No, the rate limiting is just temporary, it'll reset after 10 seconds. If you don't receive a reply at all, it's very likely the problem is at your end.
http://api.tvmaze.com/shows/1/cast doesn't work while http://api.tvmaze.com/shows/1 working. What could be the reason?
ZCB wrote:
http://api.tvmaze.com/shows/1/cast doesn't work while http://api.tvmaze.com/shows/1 working. What could be the reason?
Are you adding a forward slash / at the end by accident?
And have you checked whether it's your script that's timing out, or the connection to TVMaze?
In other words, can you do a request for http://api.tvmaze.com/shows/1/cast just by itself (no other requests) to see if the script itself takes too long and simply by the time you reach this request it's already timed out?
gazza911 wrote:
Are you adding a forward slash / at the end by accident?
And have you checked whether it's your script that's timing out, or the connection to TVMaze?
In other words, can you do a request for http://api.tvmaze.com/shows/1/cast just by itself (no other requests) to see if the script itself takes too long and simply by the time you reach this request it's already timed out?
-no I'm not adding / at the end.
-only one request.
-I think the problem is page size. the pages smaller than ~0.6kb is fine, bigger pages not.
ZCB wrote:
-no I'm not adding / at the end.
-only one request.
-I think the problem is page size. the pages smaller than ~0.6kb is fine, bigger pages not.
What function/extension are you using to get the page?
And what type of operations and loops are you using after you've retrieved the data?
gazza911 wrote:
What function/extension are you using to get the page?
And what type of operations and loops are you using after you've retrieved the data?
I'm using curl and it was working about 10 months until last week. codes still work at localhost.
I also create a new file and write codes in the simplest way I know <?php echo file_get_contents("http://api.tvmaze.com/shows/2"); ?> but it didn't work too.
ZCB wrote:
I'm using curl and it was working about 10 months until last week. codes still work at localhost.
I also create a new file and write codes in the simplest way I know but it didn't work too.
By the way, did you do as david mentioned earlier with regards to your firewall?
Migration means different IPs, so you may need to update it.
If that doesn't help, has allow_url_fopen been set to 0 in your php.ini file?
I know that it's required for file_get_contents.
gazza911 wrote:
By the way, did you do as david mentioned earlier with regards to your firewall?
Migration means different IPs, so you may need to update it.
If that doesn't help, has allow_url_fopen been set to 0 in your php.ini file?
I know that it's required for file_get_contents.
this returns 1 => echo ini_get('allow_url_fopen');
firewall doesn't make any sense to me. if it's about firewall why shows/1 working and shows/2 not. the only difference I found is the size.
david wrote:
No, the rate limiting is just temporary, it'll reset after 10 seconds. If you don't receive a reply at all, it's very likely the problem is at your end.
OK. I tried on a different server. getting /shows?page=0 to 92 completed successfully. there was no 429 or anything else, just 200.
But now I can't access the api from the new server. I think there is a hidden limitation or a bug on your side. I can't even get homepage (http://tvmaze.com) with curl anymore.
ZCB wrote:
this returns 1 => echo ini_get('allow_url_fopen');
firewall doesn't make any sense to me. if it's about firewall why shows/1 working and shows/2 not. the only difference I found is the size.
Dependant on the firewall itself, you can have rules that are based on the file size. This probably isn't the case, I'm just trying to think of any possible reason.
You should also check PHP's memory_limit setting to ensure that the script actually has enough resources to allocate everything (although I can't say how much that should be).