lichess.org
Donate

Cannot fetch single game using API in browser

https://imgur.com/oM0RGft

The url is good, because if I call it with a wrong game id, I also get a Not Found error besided the CORS error.

Strangely if I type in the same url in the browser address bar, then it works.
Thanks it is fixed now.

github.com/ornicar/lila/issues/4997

API behavior is bit odd, for if I try the id from the game link, it fails. Last 4 characters have to be removed and use this shortened id. But what if the user tries the short id?

So I ended up calling the API with both the full id and the id with last 4 characters removed, then let one of the calls fail and handle this in the fetch error handler.

This topic has been archived and can no longer be replied to.