API
Ok, I have a simple API up. Just add &api=True to any Rankings or BotDetails page and it will return in nice easy-to-parse JSON-ish format. I say JSON-ish because real JSON puts double-quotes around everything, whereas I'm lazy and don't feel like doing a ton of double-quote escaping, and besides, we don't have commas or colons in our data so there isn't any risk.
If you don't want the entire pairings detail from the BotDetails, add &limit=0 to the page and it will leave them out.
Some usage examples:
http://literumble.appspot.com/Rankings?game=nanorumble&api=True
http://literumble.appspot.com/BotDetails?game=nanorumble&name=sheldor.jk.Yatagan%201.0.5&api=True
Of course, I'd rather you call Rankings once than call BotDetails with &limit=0 985 times, because although it doesn't generate the JSON, it still has to pull all the data in, which adds up for lots of requests. I'd ask that if you are getting more than 3, rather use the Rankings.
If there's anything else you'd like me to add to the API just ask, if it's already saved in my data it should be easy to whip something up to return it.
Sweet! I'll take a look at updating RR API clients in the next couple days. (That's @roborumble on Twitter, Category:Archived RoboRumble Rankings, RumbleStats, and BedMaker.)
I'll let you know how it goes or if I hit any snags. Hopefully the JSON libs I use don't mind JSON-ish. ;)
Well, the Perl JSON library is indeed unhappy about the lack of quoting, but I think I've got it covered:
$content =~ s/([\{,]\s*)([^:\{,]*):/$1\"$2\":/g; $content =~ s/:([^\[][^,\}]*)([,\}]*)/:\"$1\"$2/g;
=)
Cool, got it working with archived rankings, eg: RumbleArchives:RoboRumble 20130324. This checks back hourly when rumbles don't have complete pairings, but that may be forever without priority battles so I'll kill it in a couple days. =)
Only useful thing that I found missing so far is that Darkcanuck's results came back sorted and had a "rank" field. Seems like you have logic for sorting in there so it'd be nice if you could honor the "order" param like you do for the normal pages, but not a big deal (/shamefully hides his bubble sort). The quote thing wasn't a huge deal for me but that might also screw some people up since I imagine most clients use a JSON parser instead of doing it manually.
And @roborumble, yay: [1]
I'll look at RumbleStats and BedMaker tomorrow. Will be nice that other people can actually use BedMaker now. =) If anyone's interested, I had to make one more tweak to my regex to properly quote the &limit=0 format:
$content =~ s/([\{,]\s*)([^:\{,]*):/$1\"$2\":/g; $content =~ s/:([^\[][^,\}\n]*)([,\}]*)/:\"$1\"$2/g;
OK, you've convinced me, I've added the quotes :-p I've also added "rank" to both Rankings and BotDetails, and the sort works too.
I would like a query which returns the full pairing matrix, with scores from all pairings. Number of battles from all pairings would also de nice.
Probably the costliest query anyone could ask.
Unfortunately, that would take more memory than I have available in a frontend, and frontends only give me 10 seconds to respond or the process gets killed. Besides, all I'd be doing in the background is doing a Rankings query to get all N of the bot names, then N x BotDetails queries to get all of the pairwise data, so it's nothing that you wouldn't be able to do just as effectively with the tools you already have.
If you do something like this, I'd ask that you put a half-second delay between all of the BotDetails queries just to leave spare capacity for client uploading.
But I agree, it would be quite interesting to see what trends etc could be found in the data.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
Return to Thread:Talk:LiteRumble/API/reply (9).
For building batch rankings systems I can understand, but it would take too long to do priority battles, which need to be run much more regularly.