speedruncomorg / api

REST API Documentation for speedrun.com
346 stars 36 forks source link

```GET /records``` var-{variable ID}-{value ID} filter is not working #153

Open ghost opened 2 years ago

ghost commented 2 years ago

I'm trying to make a world record leaderboard for every game but the request link doesn't seem to work, as the runs aren't filtered by the variable specified. Please someone take a look at this link: https://www.speedrun.com/api/v1/games/k6q4rqzd/records?skip-empty=true&max=200&offset=0&top=1&embed=players&var-2lggye3l=4lxexp31 image

Nick-NCSU commented 2 years ago

Assuming you are referring to GET /games/{id}/records which it seems your request uses: refer to the query parameters listed for this endpoint (https://github.com/speedruncomorg/api/blob/master/version1/games.md#get-gamesidrecords). The only documented query parameters are top scope miscellaneous skip-empty max offset and embed.

The var-___ query parameter is only available for the GET /leaderboards/{game}/category/{category} and GET /leaderboards/{game}/level/{level}/{category} endpoints.

danthedrummer commented 2 years ago

Those query params aren't documented in the /games route. Should you be using the /leaderboards route instead?

Something like this: https://www.speedrun.com/api/v1/leaderboards/k6q4rqzd/category/z27lez0d?skip-empty=true&max=200&offset=0&top=1&embed=players&var-2lggye3l=4lxexp31

edit: Nick beat me to it 😂

ghost commented 2 years ago

Is there any way to filter all top 1 runs by variables then?

I though every propriety of the lbs doc also applied here lmao

Nick-NCSU commented 2 years ago

No, you would need to iterate through each one using the GET /leaderboards/{game}/category/{category} endpoint with top=1. The GET /games/{id}/records returns the fastest run in a category not subcategory.

ghost commented 2 years ago

Oh well that's not good for me, also doesn't really make sense to not return the fastest run for every subcategory that has each lb