Create a world
const url = 'https://spaces.work.optidata.cloud/api/spaces/maps';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Head office — new meeting rooms"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://spaces.work.optidata.cloud/api/spaces/maps \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Head office — new meeting rooms" }'Creates a draft world. Without data, it starts from a blank office
with every layer the Spaces client expects. Builders only. name must be
unique within the company.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
A Tiled map in its JSON format (orthogonal,
32×32 tiles). It must carry type, width, height, tilewidth,
tileheight and layers. The Spaces client reads a Ground tile layer and the
object layers Wall, Chair, Objects, ObjectsOnCollide,
GenericObjects, GenericObjectsOnCollide, Computer, Whiteboard,
Basement and VendingMachine; the easiest way to get a valid document
is to create a world without data and edit the blank one it returns.
object
object
object
Zones of the world reserved for groups: an object keyed by group id, each
holding the [x, y] tile cells of that group’s area. Members of the group
may edit the world inside its area even when they are not builders. Cells
must lie inside the map.
Examples
{ "name": "Head office — new meeting rooms"}Responses
Section titled “ Responses ”The new draft, with its map document.
object
The world this one was copied from, if any.
Grows with every saved change.
A Tiled map in its JSON format (orthogonal,
32×32 tiles). It must carry type, width, height, tilewidth,
tileheight and layers. The Spaces client reads a Ground tile layer and the
object layers Wall, Chair, Objects, ObjectsOnCollide,
GenericObjects, GenericObjectsOnCollide, Computer, Whiteboard,
Basement and VendingMachine; the easiest way to get a valid document
is to create a world without data and edit the blank one it returns.
object
object
object
Zones of the world reserved for groups: an object keyed by group id, each
holding the [x, y] tile cells of that group’s area. Members of the group
may edit the world inside its area even when they are not builders. Cells
must lie inside the map.
Example
{ "status": "draft", "data": { "type": "map" }}No authentication key was sent.
Authentication failures use an error key rather than message.
object
Examples
No bearer token sent
{ "error": "JWT passport exception: Missing bearer token in request"}The caller is not allowed to do this (see “Who may do what”), or the authentication key is not recognised (empty message).
object
Examples
Not the space's owner
{ "message": "You do not have permission to update this space."}Not a builder
{ "message": "You do not have permission to view this map."}Not a super-administrator
{ "message": "You do not have permission to activate this map."}The authentication key is expired or not recognised. Get a fresh one and retry.
Authentication failures use an error key rather than message.
object
Examples
{ "error": "JWT passport expired: Passport expired"}The name is taken, or the map document is not valid.
object
The first validation message.
Validation messages keyed by field name.
object
Examples
{ "message": "The name has already been taken.", "errors": { "name": [ "The name has already been taken." ] }}