Official Content > News
Unleashing a HTTP-based API for the Soldat Lobby
jrgp:
Updates:
- I've renamed these keys:
OsType -> OS
Ip -> IP
Wm -> WM
Be -> AC
- OS is now linux, mac, or windows
- GameStyle is now the uppercase representation of the game mode rather than the number
- Added more filters. Each of these are optionally specified via URL params. Pipe (|) denotes allowed options. 3 dots denotes options that you'd expect.
?os=linux|mac|windows
?gamestyle=DM|PM|TM|CTF|RM|INF|HTF
?country=US|DE|...
?version=1.7.1|1.6.1|...
?empty=yes|no
?full=yes|no
?bots=yes|no
?private=yes|no
?realistic=yes|no
?survival=yes|no
?advanced=yes|no
For example:
https://api.soldat.pl/v0/servers?os=linux&country=US&full=no&empty=no&version=1.7.1&gamestyle=DM
machina:
Nice to see an ongoing development. Good job :D
jrgp:
--- Quote from: machina on April 19, 2017, 05:11:19 am ---Nice to see an ongoing development. Good job :D
--- End quote ---
:)
I just rewrote https://soldat.pl/en/lobby to hit this API directly via ajax, rather than the old implementation which was a php shim against the old protocol.
Looking at the html source for that page (it's not obfuscated), and the accompanying javascript file, should make it obvious how to write a similar lobby browser via ajax.
machina:
--- Quote from: jrgp on April 19, 2017, 05:23:55 am ---I just rewrote https://soldat.pl/en/lobby to hit this API directly via ajax, rather than the old implementation which was a php shim against the old protocol.
--- End quote ---
Once you got there you could set default ordering by amount of players (descending obviously). It would make more sense in my opinon to get servers where people actually play on the top of the list.
This should also be done in the Soldat GUI (game) I think. Ordering by players amount - not ping. It's not within your cup of tea though.
A bit off topic here right now:
I see that you've (just?) removed top bar with language switching as I proposed to do so long time ago because of unsupported translations etc. Note that main domain i.e.: https://soldat.pl/ points to https://soldat.pl/pl/ (where there's still that messy frontpage etc.) instead of https://soldat.pl/en/. Also, the background picture should be elevated.
jrgp:
--- Quote from: machina on April 19, 2017, 06:21:28 am ---
--- Quote from: jrgp on April 19, 2017, 05:23:55 am ---I just rewrote https://soldat.pl/en/lobby to hit this API directly via ajax, rather than the old implementation which was a php shim against the old protocol.
--- End quote ---
Once you got there you could set default ordering by amount of players (descending obviously). It would make more sense in my opinon to get servers where people actually play on the top of the list.
This should also be done in the Soldat GUI (game) I think. Ordering by players amount - not ping. It's not within your cup of tea though.
A bit off topic here right now:
I see that you've (just?) removed top bar with language switching as I proposed to do so long time ago because of unsupported translations etc. Note that main domain i.e.: https://soldat.pl/ points to https://soldat.pl/pl/ (where there's still that messy frontpage etc.) instead of https://soldat.pl/en/. Also, the background picture should be elevated.
--- End quote ---
Hmm soldat.pl shouldn't be redirecting directly to soldat.pl/pl/:
$ curl -I https://soldat.pl
HTTP/1.1 302 Found
Date: Wed, 19 Apr 2017 16:07:32 GMT
Location: https://soldat.pl/en/
I did just remove the language switching. Elevating the entire site makes sense and I'll try to get to that too.
Sorting by players descending also makes sense for the site. Not sure about ingame because that way you might have really high ping servers at the top rather than ones that you'll be able to play on comfortably.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version