HTTP API
DRAFT DOCUMENTATION - NOT RELEASED AND NOT FINAL
Planetary Processing has a simple HTTP API which can be used to manage your games. This is only accessible to games on our premium tier. All endpoints should be prefixed with https://api.planetaryprocessing.io/v1
Authentication
Your API access token can be generated in the game administration section of the control panel. It should be supplied as a bearer token in an 'Authorization' header to all requests like so: Authorization: Bearer <token>
Endpoints
Game Info and Control
GET /game
GET /game
Returns a the game associated with this access token in the following format:
POST /game/start
POST /game/start
Starts your game, will return a 200 OK
if successful, or if the game is already started.
POST /game/stop
POST /game/stop
Stop your game, will return a 200 OK
if successful, or if the game is already stopped.
POST /game/update
POST /game/update
This will deploy the latest version of your game's server-side code from your git repository. 200 OK
response if successful, note that this will still be a 200 OK
response if your game is in an error state after the update.
Game State Extraction / Importing
These endpoints are used to examine or update the state of a game that is currently switched off, they will fail if the game in question is running.
GET /game/chunk/{x}/{y}?dimension=
GET /game/chunk/{x}/{y}?dimension=
This allows you to export a chunk in the below format, specify chunk coordinates (in chunk space) and optionally specify dimension (defaults to the default dimension). If this chunk is loaded, it will fetch the live version of the chunk, else it will be retrieved from the backing store.
PUT /game/chunk
PUT /game/chunk
This allows you to explicitly import chunk data into the world, this will result in the chunk bypassing its init.lua call and instead being pre-populated as per your instructions. The same data structure as GET is used as the request body. Note that the chunk'd ID and all entity UUIDs will be automatically replaced. This can only be called while the game is off.
POST /game/entity/{uuid}
POST /game/entity/{uuid}
Sends a message to the specified entity, the request body should be the JSON representation of the Lua table to send.
Player Management
These endpoints allow creating, deleting and listing players.
GET /game/players
GET /game/players
Will return a list of players for the given game in the following format:
PUT /game/players
PUT /game/players
This endpoint creates a new player, it must include a body of the following JSON format:
DELETE /game/players/{uuid}
DELETE /game/players/{uuid}
Deletes the player with a given UUID from game {id}.
Last updated