Map Storage API _ WorkAdventure Documentation
Map Storage API _ WorkAdventure Documentation
Api Reference
Controls Map Storage API Getting the endpoint and the authentication
token
Sound
Start
State
UI
Deprecated Functions
WAM vs TMJ files, the 2 sides of WorkAdventure maps
Extended utility functions
If you have already created a map for WorkAdventure, you already know that maps are designed in Tiled. Tiled produces TMJ files,
Tiled Layers
which are JSON files that describe the map. Those files can be hosted on any web server.
Tiled Properties
Svelte You might also have noticed that WorkAdventure has an inline map editor. This editor allows you to add objets to the map such as
tables, chairs... and also interactive areas.
Variables
Scripting Internals Because the TMJ file can be hosted anywhere on the web, WorkAdventure does not have write access to the TMJ file. Therefore, the
inline map editor cannot modify the TMJ file. Instead, the inline map editor edits WAM files.
Using Typescript
Room API
Webhooks
The WAM file is a JSON file that contains the list of objects and interactive areas. It also points to the TMJ file that should be used to
render the map.
Those WAM files are stored (along other regular files) in the map-storage container. The map-storage API allows you to create, update
and delete any file within that container.
So in order to create a new room for your users, you will just need to create a new WAM file in the map-storage container.
SAAS Self-hosted
The map-storage API is protected by an authentication token. You can find this token, along the URL of the endpoint in the
administration dashboard of WorkAdventure.
Connect to your dashboard, and go to Developers > API keys / Zapier.
If you do not already have an API key, click on "Create new token".
Sample query:
PUT /my_office.wam
Authorization: Bearer [your_token]
{
// WAM file content
}
For instance, if you want to create a new room called office/first_floor.wam , you will send a PUT request to the following URL:
PUT /office/first_floor.wam
SAAS Self-hosted
https://play.workadventu.re/@/[organization_slug]/[world_slug]/office/first_floor.wam
If you are using a custom domain, the map URL will be:
https://[your_domain]/@/office/first_floor.wam
{
"version": "1.0.0",
"mapUrl": "https://your_server/your_map.tmj",
"entities": {},
"areas": [],
"entityCollections": [
{
"url": "https://play.workadventu.re/collections/FurnitureCollection.json",
"type": "file"
},
{
"url": "https://play.workadventu.re/collections/OfficeCollection.json",
"type": "file"
}
],
"metadata": {
"name": "The map name",
"description": "A description displayed when sharing the map",
"thumbnail": "https://your_server/thhumbnail.png",
"copyright": "Credits: ..."
}
}
The mapUrl property is the URL of the TMJ file that will be used to render the map.
The entityCollections property is the list of collections of objects that will be available in the inline map editor. You can learn more
about the file format of those collections in the inline map editor documentation.
GET /office/first_floor.wam
The PATCH HTTP method expects a valid JSON Patch document as the body of the request.
PATCH /office/first_floor.wam
Content-Type: application/json-patch+json'
Authorization: Bearer [your_token]
{
"op": "add",
"path": "/metadata/name",
"value": "The new name of the map"
}
DELETE /office/first_floor.wam
Authorization: Bearer [your_token]
INFO
Need help 🆘
Previous Next
« Using Typescript Room API »