From a808ac1920560434df09cdcde405f29b5bfa7027 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Fri, 5 Aug 2022 16:56:48 +0200 Subject: [PATCH] Added readme to server registry. --- registry/README.md | 34 +++++++++++++++++++ .../Aos2RegistryApiApplicationTests.java | 13 +++++++ 2 files changed, 47 insertions(+) create mode 100644 registry/README.md create mode 100644 registry/src/test/java/nl/andrewl/aos2registryapi/Aos2RegistryApiApplicationTests.java diff --git a/registry/README.md b/registry/README.md new file mode 100644 index 0000000..ce3b138 --- /dev/null +++ b/registry/README.md @@ -0,0 +1,34 @@ +# Ace of Shades Server Registry +The registry is a REST API that keeps track of any servers that have recently announced their status to it. Servers can periodically send a simple JSON object with metadata about the server (name, description, players, etc.) so that players can more easily search for a server to play on. + +### Fetching +Client/launcher applications that want to get a list of servers from the registry should send a GET request to the API's `/servers` endpoint. + +The following array of servers is returned from GET requests to the API's `/servers` endpoint: +```json +[ + { + "host": "0:0:0:0:0:0:0:1", + "port": 1234, + "name": "Andrew's Server", + "description": "A good server.", + "maxPlayers": 32, + "currentPlayers": 2, + "lastUpdatedAt": 1659710488855 + } +] +``` + +### Posting +The following payload should be sent by servers to the API's `/servers` endpoint via POST: +```json +{ + "port": 1234, + "token": "abc123", + "name": "Andrew's Server", + "description": "A good server.", + "maxPlayers": 32, + "currentPlayers": 2 +} +``` +Note that this should only be done at most once per minute. Any more frequent, and you'll receive 429 Too-Many-Requests responses, and continued spam may permanently block your server. diff --git a/registry/src/test/java/nl/andrewl/aos2registryapi/Aos2RegistryApiApplicationTests.java b/registry/src/test/java/nl/andrewl/aos2registryapi/Aos2RegistryApiApplicationTests.java new file mode 100644 index 0000000..6f1c612 --- /dev/null +++ b/registry/src/test/java/nl/andrewl/aos2registryapi/Aos2RegistryApiApplicationTests.java @@ -0,0 +1,13 @@ +package nl.andrewl.aos2registryapi; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class Aos2RegistryApiApplicationTests { + + @Test + void contextLoads() { + } + +}