CORS error while requesting games

Sort:
Avatar of Saru-Dono

Hi,
I'm using the following endpoint:
https://www.chess.com/news/view/published-data-api#pubapi-endpoint-games-archive


Upon making a request, it sometimes throws a CORS error:
Access to fetch at 'https://api.chess.com/pub/player/username/games/2019/09' from origin 'http://localhost:1234' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

 

What's interesting, is that upon a couple of retries, it no longer throws this error. After 5-6 retries I'm able to have all requests come through. I could retry them till success, but it's not an elegant solution.

I'm trying to get all games for a player, so I'm sending these requests basically in bulk. It does not seem connected, but worth noting nonetheless. 
Could you please advise on a solution for that?

On an unrelated note, is there a "dummy" player account, that I can use to test my API?

Avatar of Tricky_Dicky

It's probably the bulk send. Better to do them sequentially waiting for a response before sending another request. 

Avatar of arTleVark

I always use Hikaru as my "dummy" happy.png lots of games

Avatar of Saru-Dono
Tricky_Dicky wrote:

It's probably the bulk send. Better to do them sequentially waiting for a response before sending another request. 

CORS errors are not typical for rate limiters. Even documentation mentions that their server will respond with HTTP 429 in this case: https://www.chess.com/news/view/published-data-api#pubapi-general-rate-limits

 

Avatar of Tricky_Dicky

True. However it's pretty easy to test. Change your methodology to single requests and see if you get the same errors. If not then it's probably the answer.

Avatar of Guest2842687024
Please Sign Up to comment.

If you need help, please contact our Help and Support team.