SRB2 Master Server API v1 Draft

20 March 2020

:james:

Table of Contents

POST Requests (link here)

All requests may include a token field in the query string. This is an optional authentication.

GET Requests (link here)

POST Request Bodies (link here)

All of these are encoded according to application/x-www-form-urlencoded. The following fields are valid for each request. Fields are mandatory unless stated otherwise.

servers...unlist has no body.

rooms...register (link here)

Field Name Example
port
5029
title
SRB2%20Server
version
2.2.2

servers...update (link here)

The following fields are optional.

Field Name Example
title
Wow%2CMaster%20Server%21

Response Bodies (link here)

Response bodies are plain text. Fields are delimited by special characters. For lists, each entry is also delimited by a special character or sequence. Fields must be in order. Fields may posses special encoding, if specified.

ASCII character values are in decimal.

Server Registration (link here)

Field Name Example
Server ID 11920

Server ID ends with a line feed (ASCII 10).

Room Listings (link here)

Field Name Example
Room Number
33
Room Title
Standard
Room Description
The Standard room.

Room Number and Room Title end with a single line feed (ASCII 10).

Room Description ends with two line feeds (ASCII 10). A third line feed is always present, but this is part of the field itself. Being delimited by a double line feed allows this field to contain empty lines, useful for paragraphs.

Because of the unique delimiting on Room Description, an entire listing may be delimited by three consecutive line feeds (ASCII 10).

The list of rooms (/rooms) is composed by listings in no particular order.

Server List (link here)

Server listings are grouped by room. Each group starts with a room number, followed by the server listings. The room number as well as the group itself ends with a line feed (ASCII 10).

Each listing has the following fields.

Field Name Example
Address
127.0.0.1
Port
5029
Title
SRB2%20Server
Version
2.2.2

Port, Title and Version are percent-encoded.

Address, Port and Title end with a space (ASCII 32). Version ends with a line feed (ASCII 10).

Because both listings and groups end with a line feed (ASCII 10), and listings are the final element in a group, an entire group may be delimited by two consecutive line feeds.

Version Listing (link here)

Field Name Example
Version 24
Version Name v2.2.2

Version ends with a space (ASCII 32). Version Name ends with a line feed (ASCII 10).

Status Codes (link here)

Status 200 is returned for any successful request.

ASCII character values are in decimal.

The following errors may be returned, with a short description in the response body, in plain text. The description is terminated by a line feed (ASCII 10).

Code Reason
400 Request was malformed. Some field missing or invalid API path.
403 A request cannot be performed. Registering a server with the same port twice for instance.
404 Room or server could not be found.