In other languages:

Matchmaking API: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
m (Added languages template, must be on all pages)
mNo edit summary
 
(41 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Languages}}
{{Languages}}
<div align="center" class="stub">'''Category:''' [[Factorio_HTTP_API_usage_guidelines#Internal|Internal API]]</div>


The matchmaking API allows Factorio servers to advertise themselves, and for players to browse open game servers. The matchmaking server currently uses [https://www.heroku.com/ Heroku] as the application platform.
The matchmaking API allows Factorio servers to advertise themselves, and for players to browse open game servers. The matchmaking server currently uses [https://www.heroku.com/ Heroku] and [http://gunicorn.org/ Green Unicorn] software.


<code>API root: https://multiplayer.factorio.com/</code>
<code>API root: https://multiplayer.factorio.com/</code>
Some of the API endpoints require the use of an authentication token, which is obtained through the [[Web Authentication API]]. It is sent as the HTTP parameter named <code>token</code> and encoded using hexadecimal. All requests are encoded as JSON objects.


Work in progress! I'm just going to jot down some random notes in the mean time :P
Work in progress! I'm just going to jot down some random notes in the mean time :P
https://multiplayer.factorio.com/get-games
https://multiplayer.factorio.com/get-game-details/ Unauthenticated


https://multiplayer.factorio.com/create-game
https://multiplayer.factorio.com/create-game
Line 11: Line 18:
https://multiplayer.factorio.com/post-game-heartbeat/
https://multiplayer.factorio.com/post-game-heartbeat/


https://multiplayer.factorio.com/get-games
https://multiplayer.factorio.com/remove-game/
 
== Object Types ==
 
=== Server Description Object ===
 
{| class="wikitable"
! rowspan="1" | Key
! rowspan="1" | Type
!+ style='writing-mode:vertical-lr;vertical-align:bottom;font-size:80.9%' | get-games
!+ style='writing-mode:vertical-lr;vertical-align:bottom;font-size:80.9%' | get-game-details
!+ style='writing-mode:vertical-lr;vertical-align:bottom;font-size:80.9%' | create-game
! rowspan="1" | Description
|-
| application_version
| object
| ✓
| ✓
| ✓
| See [[#Application Version|application version]] below.
|-
| description
| string
|
| ✓
| ✓
| The server's description.
|-
| game_id
| integer
| ✓
| ✓
| ✓
| A unique id generated by the matchmaking server to identify a server for other API endpoints.
|-
| game_secret
| string
|
|
| ✓
|
|-
| game_time_elapsed
| string(integer)
| ✓
| ✓
| ✓
| Number of in-game minutes the loaded map has elapsed.
|-
| has_password
| string(boolean)
| ✓
| ✓
| ✓
| "true" if a password is required to join the server.
|-
| host_address
| string(ip:port)
|
| ✓
| ✓
| The IP address and port number the game server is hosted on.
|-
| last_heartbeat
| number
|
| ✓
|
| The Unix timestamp of when the game server was last heard from.
|-
| max_players
| string(integer)
| ✓
| ✓
| ✓
| Maximum number of players allowed to connect at once. 0 = unlimited.
|-
| mod_count
| integer
| ✓
|
|
| Number of mods installed on the server.
|-
| mods
| object[]
|
| ✓
| ✓
| List of [[#Mod Description|mods and their versions]] installed on the server.
|-
| mods_crc
| integer
|
| ✓
|
|
|-
| name
| string
| ✓
| ✓
| ✓
| Server's name.
|-
| players
| string[]
| ✓
| ✓
|
| List of player's usernames connected to the server.
|-
| require_user_verification
| string(boolean)
| ✓
| ✓
| ✓
| "true" if the server requires the user to be logged in to join.
|-
| server_id
| string
| ✓
| ✓
|
|
|-
| tags
| string[]
|
| ✓
| ✓
| List of server tags.
|}
 
=== Application Version ===
 
{| class="wikitable"
! Key
! Type
! Description
|-
| build_mode
| string
| "alpha", "headless", or "steam".
|-
| build_version
| string(integer)
| The build version associated with the game version.
|-
| game_version
| string
| Game version running on the server, e.g. "0.14.21".
|-
| platform
| string
| OS the server is running on: "linux64", "mac", or "win64".
|}
 
=== Mod Description ===
 
{| class="wikitable"
! Key
! Type
! Description
|-
| name
| string
| ID of the mod.
|-
| version
| string
| Version string of the mod.
|}
 
=== Error Message ===
 
This object is returned whenever there's been an error with your request.
 
{| class="wikitable"
! Key
! Type
! Description
|-
| message
| string
| A short description of the error.
|}
 
== Endpoints ==
 
=== get-games ===
 
<code>GET https://multiplayer.factorio.com/get-games</code>
 
Returns the available Factorio game servers as a list of [[#Server Description Object|Server Description Objects]], but only with the object keys marked as available in the "get-games" column. Requires two GET parameters:
 
{| class="wikitable"
| username || The factorio username associated with the auth token.
|-
| token || A valid auth token, as obtained using the [[Web Authentication API]].
|}
 
'''Exceptions'''
* "Missing username."
* "User not found."
* "Token doesn't match."
 
=== get-game-details ===
 
<code>GET https://multiplayer.factorio.com/get-game-details/<nowiki>{game_id}</nowiki></code>


https://multiplayer.factorio.com/get-game-details/
Returns more details about the server, where {game_id} is the server's game_id as seen in the response from the get-games endpoint. This endpoint doesn't require an authentication token.




[[Category:Technical]]
[[Category:Technical]]

Latest revision as of 09:58, 25 February 2022

Category: Internal API

The matchmaking API allows Factorio servers to advertise themselves, and for players to browse open game servers. The matchmaking server currently uses Heroku and Green Unicorn software.

API root: https://multiplayer.factorio.com/

Some of the API endpoints require the use of an authentication token, which is obtained through the Web Authentication API. It is sent as the HTTP parameter named token and encoded using hexadecimal. All requests are encoded as JSON objects.

Work in progress! I'm just going to jot down some random notes in the mean time :P

https://multiplayer.factorio.com/get-games

https://multiplayer.factorio.com/get-game-details/ Unauthenticated

https://multiplayer.factorio.com/create-game

https://multiplayer.factorio.com/post-game-heartbeat/

https://multiplayer.factorio.com/remove-game/

Object Types

Server Description Object

Key Type get-games get-game-details create-game Description
application_version object See application version below.
description string The server's description.
game_id integer A unique id generated by the matchmaking server to identify a server for other API endpoints.
game_secret string
game_time_elapsed string(integer) Number of in-game minutes the loaded map has elapsed.
has_password string(boolean) "true" if a password is required to join the server.
host_address string(ip:port) The IP address and port number the game server is hosted on.
last_heartbeat number The Unix timestamp of when the game server was last heard from.
max_players string(integer) Maximum number of players allowed to connect at once. 0 = unlimited.
mod_count integer Number of mods installed on the server.
mods object[] List of mods and their versions installed on the server.
mods_crc integer
name string Server's name.
players string[] List of player's usernames connected to the server.
require_user_verification string(boolean) "true" if the server requires the user to be logged in to join.
server_id string
tags string[] List of server tags.

Application Version

Key Type Description
build_mode string "alpha", "headless", or "steam".
build_version string(integer) The build version associated with the game version.
game_version string Game version running on the server, e.g. "0.14.21".
platform string OS the server is running on: "linux64", "mac", or "win64".

Mod Description

Key Type Description
name string ID of the mod.
version string Version string of the mod.

Error Message

This object is returned whenever there's been an error with your request.

Key Type Description
message string A short description of the error.

Endpoints

get-games

GET https://multiplayer.factorio.com/get-games

Returns the available Factorio game servers as a list of Server Description Objects, but only with the object keys marked as available in the "get-games" column. Requires two GET parameters:

username The factorio username associated with the auth token.
token A valid auth token, as obtained using the Web Authentication API.

Exceptions

  • "Missing username."
  • "User not found."
  • "Token doesn't match."

get-game-details

GET https://multiplayer.factorio.com/get-game-details/{game_id}

Returns more details about the server, where {game_id} is the server's game_id as seen in the response from the get-games endpoint. This endpoint doesn't require an authentication token.