Reputation: 41
I would like to know how to use the Steamworks Web API to query a server to get information (server name, game, map, players, etc.). I know that using the A2S query (https://developer.valvesoftware.com/wiki/Server_queries) can give that information, but I would like to know if it is possible using the Steamworks Web API instead.
Thanks!
Upvotes: 4
Views: 8747
Reputation: 61
With IGameServersService/GetServerList. Here is an example:
https://api.steampowered.com/IGameServersService/GetServerList/v1/?key=API_KEY&filter=addr\YOUR.IP.ADRESS:PORT
For example, to get the map of a Garry's Mod server, you can try the following (code example is in PHP):
$url = "https://api.steampowered.com/IGameServersService/GetServerList/v1/?key=API_KEY&filter=addr\185.254.99.6:27015";
$json = file_get_contents($url);
$table2 = json_decode($json, true);
$table = $table2["response"]["servers"][0];
$mapname = $table['map'];
Upvotes: 6