#lastFen in Lichess API not working

5 messages · Page 1 of 1 (latest)

outer ember
#

For the Games by User endpoint https://lichess.org/api/games/user/{user}, passing in the flag lastFen as true does not seem to be returning any different information than when it is false.

source

URL (without FEN): https://lichess.org/api/games/user/drcoffeekill?lastFen=false&max=5
RESPONSE: ```
[Event "Rated Blitz game"]
[Site "https://lichess.org/rzIQnYAw"]
[Date "2023.11.10"]
[White "drcoffeekill"]
[Black "PetKavGR"]
[Result "1-0"]
[UTCDate "2023.11.10"]
[UTCTime "15:59:44"]
[WhiteElo "1840"]
[BlackElo "1901"]
[WhiteRatingDiff "+7"]
[BlackRatingDiff "-6"]
[Variant "Standard"]
[TimeControl "180+0"]
[ECO "D00"]
[Termination "Time forfeit"]

  1. d4 d5 ... Qc3 1-0

URL (with FEN): `https://lichess.org/api/games/user/drcoffeekill?lastFen=true&max=5`
RESPONSE: ```
[Event "Rated Blitz game"]
[Site "https://lichess.org/rzIQnYAw"]
[Date "2023.11.10"]
[White "drcoffeekill"]
[Black "PetKavGR"]
[Result "1-0"]
[UTCDate "2023.11.10"]
[UTCTime "15:59:44"]
[WhiteElo "1840"]
[BlackElo "1901"]
[WhiteRatingDiff "+7"]
[BlackRatingDiff "-6"]
[Variant "Standard"]
[TimeControl "180+0"]
[ECO "D00"]
[Termination "Time forfeit"]

1. d4 d5 ... 76. Qc3 1-0
twin sluice
#

It's because you don't send the right headers

#

The response type must be set to application/x-ndjson by the request Accept header.

#

I agree the doc isn't super clear about it, only mentioning ...games of any user in PGN or ndjson format.

outer ember
#

Updating the header does seem to fix it. Thank you!