for example if i wanted https://www.speedrun.com/polybridge2#Pine_Mountains, but also in challenge mode and in 100% nma, i have a fetch already done i just need to know how to properly set up the urls to be grabbed
I'm confused on what you're asking. Are you asking which endpoints you should be using, or how to setup the URL itself?
Do you just want all runs under the Pine Mountains category (regardless of subcategory)? I'd fetch /runs with a filter of category (https://www.speedrun.com/api/v1/runs?category=<category ID here>) and then filter the runs by variable/value. This gets all obsoleted runs as well.
Alternatively you can get the leaderboard endpoint with filters of var-___ multiple times to get each leaderboard separately.
oh hey a person that actually has run pb
i dont know how to get the ids + how to set up subcatagories in the url
If you only need to get the category ID once, you can fetch the game categories endpoint like so (with an embed of variables to get the variables that apply to the category): https://www.speedrun.com/api/v1/games/polybridge2/categories?embed=variables (using abbreviation in place of ID here since it's one-time, if you're doing this in code i'd replace it with game ID)
And then you could manually search the results to find Pine Mountains (or check this pragmatically) to see it's ID is 'xk9vl5vd' You can then get the information for the variables by going to Categories[i].variables.data. Here the name of the id/variable is at the top, and each of the possible values are defined in values.values. Consult the documentation on the structure of the Variable object.
Here, the ID for "Normal or Challenge" is "rn10jwd8" and the value ID for Normal is "jq6k2o7l". The ID for "Glitches" is "onvj7gwn" and the value ID for Any% NMA is "21dr0e5q"
Then you can fetch from the runs endpoint with the filter set to the category ID you just got: https://www.speedrun.com/api/v1/runs?category=xk9vl5vd&var-rn10jwd8=jq6k2o7l&var-onvj7gwn=21dr0e5q
Which would get you each run for Pine Mountains - Normal, Any% NMA.
Alternatively, you can just fetch the category and manually sort the variables in code later. What exactly are you trying to do? It might help me understand what you need, but hopefully the above is enough.
And yeah, I did have a Poly Bridge phase :^)
thank you diggity i figured it out
and bacon i did read them and found nothing of use and if someones helping me do you really need to come in and say read the docs
Does the ?var-{id}={value} parameter syntax not work anymore? For example if I just look up https://www.speedrun.com/api/v1/runs?category=xk9vl5vd&var-rn10jwd8=jq6k2o7l&var-onvj7gwn=21dr0e5q I find one run that has "5lmjd34l" as value instead of "jq6k2o7l" as requested. Removing that query parameter gives the exact same result back. Is there another way to filter by category variables?
Edit: It does work for the /leaderboards endpoint but not /runs for some reason