Page 1 of 1

Matchmaking API

Posted: Tue Jul 12, 2022 6:18 pm
by squiddog
Team,

Is the API supported? I am able to authenticate, and use the get-games endpoint, but the get-game-details endpoint generates a "404 Not Found"

Re: Matchmaking API

Posted: Mon Jul 18, 2022 9:44 am
by vinzenz
404 means the matching server doesn't know about the given game id, can you provide more details?

Re: Matchmaking API

Posted: Mon Jul 18, 2022 2:38 pm
by squiddog
Example (redacted token)

Code: Select all

https://multiplayer.factorio.com/get-games?username=squiddog&token=REDACTED
This returns (I am clipping it off)

Code: Select all

[
    {
        "game_id": 12975085,
        "name": "Factorio Server",
        "description": "Hosted by Nodecraft.com",
        "max_players": 0,
        "application_version": {
            "game_version": "1.1.61",
            "build_version": 59839,
            "build_mode": "headless",
            "platform": "linux64"
        },
        "game_time_elapsed": 510,
        "has_password": false,
        "server_id": "wkhWdIc4jhl/wKYb6LY0RXeJ+CZHDnMHEjaUwlygAWQ=",
        "tags": [
            "game",
            "tags",
            "nodecraft"
        ],
        "headless_server": true,
        "has_mods": true,
        "mod_count": 51
    },
    {
        "game_id": 12942089,
        "name": "[WIF] Factorio",
        "description": "Wif Factorio Server",
        "max_players": 0,
        "application_version": {
            "game_version": "1.1.61",
            "build_version": 59839,
            "build_mode": "headless",
            "platform": "linux64"
        },
        "game_time_elapsed": 1593,
        "has_password": true,
        "server_id": "Ucv60GgoeS+RZMsru/t7huCGIa1opmb9wZxJa9c6EM4=",
        "tags": [
            "game",
            "tags",
            "nodecraft"
        ],
        "headless_server": true,
        "has_mods": true,
        "mod_count": 20
    },
    {
        "game_id": 10955453,
        "name": "Tuuttiposse Factorio Server!",
        "description": "Einarin työhönvalmennus kurssi",
        "max_players": 20,
        "application_version": {
            "game_version": "1.1.42",
            "build_version": 59009,
            "build_mode": "headless",
            "platform": "linux64"
        },
        "game_time_elapsed": 1300,
        "has_password": true,
        "server_id": "PMlscmzh2ANhFroEg8+XjeSbrkYCtUb2tETLu9mkfGU=",
        "tags": [
            "tuuttiposse"
        ],
        "has_mods": false,
        "mod_count": 0
    },
    {
        "game_id": 13010165,
        "name": "factoribruh",
        "description": "yeeeeeeeeeeeeeeet",
        "max_players": 20,
        "application_version": {
            "game_version": "1.1.61",
            "build_version": 59839,
            "build_mode": "headless",
            "platform": "linux64"
        },
        "game_time_elapsed": 796,
        "has_password": true,
        "server_id": "sb6uAghktQksXGNzqENXNdvtd4ILwflg9Smme5n7bsE=",
        "tags": [
            "mobiusnone"
        ],
        "headless_server": true,
        "has_mods": true,
        "mod_count": 3
    },
If I then try and use any of those game IDs, like

Code: Select all

https://multiplayer.factorio.com/get-game-details/?game_id=13010165
I get:

Code: Select all

<!doctype html>
<html lang=en>
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try
	again.</p>

Re: Matchmaking API

Posted: Mon Jul 18, 2022 4:40 pm
by squiddog
It seems more like the specific API "get-game-details" is not found. This is not an application error. Other Matchmaker API calls that have bad or missing parameters return explicit errors. I can misspell the key and it's the same error.

Re: Matchmaking API

Posted: Mon Jul 18, 2022 4:48 pm
by Bilka
squiddog wrote: Mon Jul 18, 2022 2:38 pm If I then try and use any of those game IDs, like

Code: Select all

https://multiplayer.factorio.com/get-game-details/?game_id=13010165
It should be https://multiplayer.factorio.com/get-ga ... s/13010165, without the "?game_id=". This is documented here: https://wiki.factorio.com/Matchmaking_A ... me-details

Re: Matchmaking API

Posted: Mon Jul 18, 2022 7:29 pm
by squiddog
Well oh crap, that was obvious. Thanks!

Re: Matchmaking API

Posted: Mon Jul 18, 2022 7:30 pm
by squiddog
As long as I have you here....

Is there an easy way to, from the API, find a specific game (maybe matching a name)? Vs getting the list of all games and then parsing the JSON?

Re: Matchmaking API

Posted: Mon Jul 18, 2022 9:01 pm
by squiddog
Never mind, I can use jq on the whole json and get my gameIDs and other info in a single line.