This is an old revision of the document!
Table of Contents
The Laelith API
The API is a classic JSON-based REST API.
Also check out the The Laelith Authentication.
GET /hello
An easy way for developers to test if the API works.
GET /cadastre
Get the list of all Cadastre elements (Lots, streets, etc.). See the Cadastre format for more information.
The Cadastre is a 5400×3900 meter map with the (0,0) point being somewhere at the top-left corner, and the y-axis looking down. 1.0 = 1 meter
GET /cadastre/{id}
Get the details of a specific Cadastre element. See the Lot format for more information.
GET /cadastre/{alias}
Same as GET /cadastre/{id}, but using an alias instead of a numerical id.
PUT /cadastre/{id}/user
Change the owner of a Cadastre element. Requires admin or cartographer access.
Payload: owner_id
The end-point returns the complete element details.
PUT /cadastre/{id}/widgets
Change the owner of a Cadastre element. Requires admin or cartographer access.
Payload: Array of widgets data
The end-point returns the complete element details.
GET /cadastre/{id}/preview
GET /cadastre/{alias}/preview
Return a 400×400 PNG file that contains the NFT image of a Cadastre element.
GET /cadastre/{id}/mapview
GET /cadastre/{alias}/mapview
Return a 256×256 PNG file that shows a map image of a Cadastre element.
GET /network
Return the graph of the streets, plazas and gardens network.
GET /heightmap
Return the Height Map. It is a simple table 1081 x 781 table of z values. So it provides a resolution of 5 meters (1080×780 for the 5400×3900 m map).
Don't forget that element [0,0] represents the top-left corner. Here is a simple map-to-height Typescript function using bilinear interpolation and that works even outside the bounds of the map:
const ELEVATION_GRID_H = 1080; // Index goes from 0 to ELEVATION_GRID_H *included* const ELEVATION_GRID_V = 780; function getAltitude(heightMap: number[][], pt: Point): number { const u = Math.max(Math.min((pt.x / 5400.0 * ELEVATION_GRID_H), ELEVATION_GRID_H), 0); const v = Math.max(Math.min((pt.y / 3900.0 * ELEVATION_GRID_V), ELEVATION_GRID_V), 0); const u_i = Math.floor(u); const u_f = u - u_i; const v_i = Math.floor(v); const v_f = v - v_i; let z = heightMap[u_i][v_i] * (1 - u_f) * (1 - v_f); if (u_f != 0 && u_i < ELEVATION_GRID_H) { z += heightMap[u_i + 1][v_i] * u_f * (1 - v_f); } if (v_f != 0 && v_i < ELEVATION_GRID_V) { z += heightMap[u_i][v_i + 1] * (1 - u_f) * v_f; } if (u_f != 0 && v_f != 0 && u_i < ELEVATION_GRID_H && v_i < ELEVATION_GRID_V) { z += heightMap[u_i + 1][v_i + 1] * u_f * v_f; } return z; }
Altitude 0 is the lake. Values go from about -750 m to +1300 m.
GET /cache
Recompute from scratch the entire cadastre for ALL elements and build the Cadastre file. Very slow
GET /cache/{id}
Recompute the cache of a single Cadastre element. This also updates the Cadastre file, but in a fast manner.
GET /cache/{alias}
Same as GET /cache/{id}, but using an alias instead of a numerical id.
GET /cache/cadastre
Build the Cadastre file by assembling all the cached elements. Reasonnably fast.
GET /user/{user_id}
Get public information about a user account and his/her current Character (aka PC), if any.
Example: https://api.laelith.com/user/1
GET /character/{character_id}
Get details about a character. Result includes the id of the user the character belongs to.
Example: https://api.laelith.com/character/1
GET /character/{character_id}/lots
Get the list of Cadastre elements that belong to a character.
GET /ontology
Get a hierarchy representation of the Ontology. For more information, see lael3ndx_ontology.
GET /ontology/i18n
Get an English and French translation table of the Ontology.
GET /ai/hello
Test if the AI service is up-and-running.
POST /ai/names
Generate a list of character names.
- species: “human” (default), “dwarf”, “elf”, “gnome”, “felys”, “orc”, “gopneldaun”, “halfling”, “half-elf”, “half-orc”, or “utruz”. You can use other values at your own risks.
- gender: “male” (default) or “female”.
- origin: “laelith” (default), “grand duchy of agramor”, “azilian march”, “egonzasthan shires federation”, “gardens of jadhys”, “barony of kaoca”, “matriarchate of olizya”, “outskirts”, or “beyond the sunset marches”. You can use other values at your own risks.
- lang: language: “en” (default) or “fr”
- count: integer, number of names to generate. 8 by default.
POST /shell/claim
Allows the Logged-in user (identified by its Bearer Token) to claim a Shell Code (Invitation). This creates a 'character_slot' asset and transfers the Elith associated with the Invitation to the user. This operation is Captcha-protected.
GET /myassets
Returns the list of Assets owned by the logged-in user.
PUT /assets/character/{character_id}
Allows to update the Name and/or Avatar of the Player Character of the specified ID (owned by the logged-in user).
