Closed Craigbavender closed 9 years ago
Why would you query all the runs for a category? If you want leaderboards use the old Records API with restids=yes
.
According to the old records API, all that I've seen available is: ?game=Game title
, ?series=Series
, ?user=Username
. Adding restids=yes
to a game query isn't doing anything for me, see:
http://www.speedrun.com/api_records.php?game=Mega%20Man%20X&restid=yes
What am I doing wrong there?
And to answer your question, I'm querying runs for specific categories because currently the v1 api doesn't support getting complete leaderboard data in a single request, so I have to get game and categories, then get runs based on category ids.
You also need amount=99999
or some large number to query all the records. Otherwise it will only return a single value. Also, this Issue is still fine, as I would want embedded users for Runs too (in some situations it's still useful).
Thank you. Is there a list of available legacy api commands somewhere I can use for the time being?
http://www.speedrun.com/Speedrunning/guide/faq00 Scroll down to the API section.
Also your URL has restid
instead of restids
.
Querying runs in a given category is a perfectly valid usecase for the API. I see no issue with that.
When it comes to embedding the players (note that besides users there are guests), that's certainly possible. There are quite a few things that are still missing, like embedding the category, level etc. as well.
If you want to implement a proper leaderboard (and not wait until I migrated the old one), good luck and have fun. For simple things it seems easy enough, but when you have custom variables that control how and if runs obsolete each other, things get messy real quick. I would advise against crawling down that rabbit hole and instead just wait a bit more until the leaderboard is finally in our API. ;-)
Sounds good, thank you. I'm going to go ahead and use the legacy api for the time being to gather the simple run data I'm after. I'll keep up with api changes and implement them as it's improved.
The restids
parameter for api_records.php
is now gone (or enabled by default, depends on your viewpoint), as run IDs are encoded on the website as well.
You can now embed the players in runs by using ?embed=players
. Compare http://www.speedrun.com/api/v1/runs/9yoj8n7m with http://www.speedrun.com/api/v1/runs/9yoj8n7m?embed=players for a run by multiple users and one guest.
Documentation will be updated later.
d2693ae4dd0305b resolves this.
Any plans to implement this? The 50 request limit is rough if anyone is trying to associate a run with user for any category with > 50 runs.