Difference between revisions of "Lobby HTTP API"
| Line 36: | Line 36: | ||
"BonusFreq": 0, | "BonusFreq": 0, | ||
"ConnectionType": 3, | "ConnectionType": 3, | ||
| − | "Country": " | + | "Country": "US", |
| − | "CurrentMap": " | + | "CurrentMap": "ctf_Viet", |
"Dedicated": true, | "Dedicated": true, | ||
| − | "GameStyle": " | + | "GameStyle": "CTF", |
| − | "IP": " | + | "IP": "108.61.204.90", |
| − | "Info": " | + | "Info": "~ facebook.com/AUS7RAL12 | #austral12soldat @ Qnet", |
| − | "MaxPlayers": | + | "MaxPlayers": 12, |
| − | "Name": " | + | "Name": "=AUS7RAL|12 OneShots", |
"NumBots": 0, | "NumBots": 0, | ||
| − | "NumPlayers": | + | "NumPlayers": 1, |
"OS": "linux", | "OS": "linux", | ||
| − | "Port": | + | "Port": 23075, |
"Private": false, | "Private": false, | ||
"Realistic": false, | "Realistic": false, | ||
| Line 54: | Line 54: | ||
"Version": "1.7.1", | "Version": "1.7.1", | ||
"WM": false | "WM": false | ||
| − | }] | + | } |
| + | ] | ||
} | } | ||
Revision as of 08:15, 1 September 2017
Recently, we added a standard json-based REST HTTP API to make getting the list of Soldat servers much easier for third party applications, compared to the legacy Client-Lobby_Protocol.
- URL: http://api.soldat.pl (https is also supported)
- CORS headers are present so this can be used via ajax.
- Forum thread where this was originally announced
List all servers, with filters
http://api.soldat.pl/v0/servers
List all Soldat servers. You can provide a combination of these GET parameters as filters:
?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
Example URL filtering servers that aren't empty and don't have bots:
http://api.soldat.pl/v0/servers?empty=no&bots=no
Example response:
{
"Servers": [
{
"AC": false,
"Advanced": false,
"BonusFreq": 0,
"ConnectionType": 3,
"Country": "US",
"CurrentMap": "ctf_Viet",
"Dedicated": true,
"GameStyle": "CTF",
"IP": "108.61.204.90",
"Info": "~ facebook.com/AUS7RAL12 | #austral12soldat @ Qnet",
"MaxPlayers": 12,
"Name": "=AUS7RAL|12 OneShots",
"NumBots": 0,
"NumPlayers": 1,
"OS": "linux",
"Port": 23075,
"Private": false,
"Realistic": false,
"Respawn": 0,
"Survival": false,
"Version": "1.7.1",
"WM": false
}
]
}
Get data on server
http://api.soldat.pl/v0/server/$ip/$port
Example response:
{
"AC": false,
"Advanced": false,
"BonusFreq": 0,
"ConnectionType": 3,
"Country": "US",
"CurrentMap": "Island2k5",
"Dedicated": true,
"GameStyle": "DM",
"IP": "207.152.134.13",
"Info": "Eat Moar Chik'n",
"MaxPlayers": 10,
"Name": "Drop a Penny",
"NumBots": 0,
"NumPlayers": 0,
"OS": "windows",
"Port": 23073,
"Private": false,
"Realistic": true,
"Respawn": 0,
"Survival": false,
"Version": "1.7.1",
"WM": false
}
Get players for a server
http://api.soldat.pl/v0/server/$ip/$port/players
This will make the lobby use the file download protocol to grab that server's gamestat.txt file and parse and display the players currently in the server. FYI: This makes use of caching to prevent abuse.
Example response:
{
"Players": [
"/././a.d.i.d.a.s/././",
"Alvarez",
"Freedom Fighter",
"Guenther Gummibrot",
"summer camp",
"|TPF. GottenSikici"
]
}