Create a room using WebSockets API

Hello again! As I posted in my previous post, I’m trying to provide an easy way to replicate my space. I’m trying to generate all the rooms into a freshly created space, without having to use the web interface. I have to create 7 rooms, is it possible to add rooms to a space using the API?


Hi! What you’re looking for is this http endpoint

I meant to say that as well…

Let me know if you need help with that. I’ve setter up this kind of stuff a lot, in the past

Hi again!

Thank you for the response! However, I don’t think that is what I need, maybe I did not explain myself properly. I need to add new rooms to an empty space, not making a copy of an existing one. My problem is that I want to programmatically generate my space, so other developers (which do not have permission to make a copy of my space), can get their own managed copy. I am already able to set everything on the room (BG and FG images, and every object in the room), given that the person who is trying to replicate the space creates the rooms in the space and copies the room IDs to a config file. I am trying to automate that first step also. Is it possible to do it with the API? Thanks again! :smiley:

I think @npfoss was correct, the Rest API will do what you want. The issue is permissions. Either your users will need to generate the space, then give whatever account owns the template permission to modify the space at an Admin or Builder level, or the account that owns the template could give permissions to the users to copy the space (probably a bad idea, though).

What is the benefit in your use case to having the user start with a blank space and “build out” the template? Would it not be better to copy the space in its entirety all at once? Or are you trying to allow users to build off of existing spaces?

1 Like

The idea is to make the replication of my space by other users as easy as possible, without needing to involve me (the space is an educational escape room, and I would like other teachers to use it freely without even having to ask for permission). I will provide the maps, objects and code to listen to events in open, so I have thought that providing also a script that take a fresh space and prepares the room layout automatically using the API would be a nice way to speed the replication process. Potential users are already capable of reproducing my space, just by using the Mapmaker tool and following the steps I’m writing, but a script to automate all of this burden could be great.

Just spitballing, but this is the process I would go with:

  1. Store a JSON copy of the map template on an external source.
  2. Create a website that allows the user to request a copy using their API key.
  3. Website uses the Rest API to generate the new space, and spits out the URL to the user.

From that, they have a copy of the space. The script, however, would need to be hosted somewhere and run with a connection to the new space. This would require either the use of the submitted API key (not great, privacy wise), or they would need to add your API account, with the correct permissions, after the space was create to activate the listeners. Then your code would need to establish that connection.


Oh, ok, I see your point. It is probably the best way to do it. I’ll try to follow that path. Thanks!