A couple of steps are needed to perform a preset change in our system.
Getting a list of spaces and presets
Patching a selected space with the desired preset
That data can be fetched from the interactive API or other HTTP request methods.
Getting a list of spaces
This is done through the GET /spaces method. Here is a sample data output. You can try it out yourself.
{"1ca6407b-05f7-4bee-ac93-ec8c19879749": {"name":"Conference breakout","presets": {"023c3d35-5d5c-4def-aea2-3ae07c88ddae": {"name":"Preset 1 for Conference breakout" },"75258a79-f949-44e2-b248-519665a404f2": {"name":"Preset 2 for Conference breakout" } },"active_preset_id":"023c3d35-5d5c-4def-aea2-3ae07c88ddae","active_environmental_conditions_id":null },"1d32edb0-4a56-4571-a6c5-49050ca06d51": {"name":"Main Hall","presets": {"23d6cd0e-5b53-460b-9202-b152538850c0": {"name":"Preset 2 for Main Hall" },"51fa103c-44bb-4ccd-96f7-4c0c2d90c34f": {"name":"Preset 3 for Main Hall" },"9d2514db-0cf6-4cdf-86fc-362f16e3e6d7": {"name":"Preset 1 for Main Hall" } },"active_preset_id":"23d6cd0e-5b53-460b-9202-b152538850c0","active_environmental_conditions_id":null,"environmental_conditions": {"temperature_celsius":20,"atmospheric_pressure_pascal":101325,"humidity_percentage":50 } },"e37c777e-a4b4-4edb-b9dc-d28a497517cf": {"name":"Food court","presets": {"daa1d51e-9e16-47d7-b142-d6e921acf9bc": {"name":"Preset 1 for Food court" } },"active_preset_id":null,"active_environmental_conditions_id":null }}
In the response above, you can already see the list of available spaces (“Conference breakout,” “Main Hall,” and “Food Court”) and their respective presets. Each space and Preset is referenced by a unique identifier (UUID).
For this example, let’s examine the “Main Hall”. Its ID is 1d32edb0-4a56-4571-a6c5-49050ca06d51.
…"1d32edb0-4a56-4571-a6c5-49050ca06d51": {"name":"Main Hall","presets": {"23d6cd0e-5b53-460b-9202-b152538850c0": {"name":"Preset 2 for Main Hall" },"51fa103c-44bb-4ccd-96f7-4c0c2d90c34f": {"name":"Preset 3 for Main Hall" },"9d2514db-0cf6-4cdf-86fc-362f16e3e6d7": {"name":"Preset 1 for Main Hall" } },"active_preset_id":"23d6cd0e-5b53-460b-9202-b152538850c0","active_environmental_conditions_id":null,"environmental_conditions": {"temperature_celsius":20,"atmospheric_pressure_pascal":101325,"humidity_percentage":50 } },…
It has three available presets, and the currently active preset is Preset 2 for Main Hall.
Changing the active preset
We will use the PATCH /spaces/{space-id} method for this operation. We will change the active preset to Preset 1 for Main Hall. The method takes a request body with the following format:
cURL is a program available on Windows 10 and above, MacOS, and Linux OS. It provides a simple way to interact with HTTP endpoints and test API requests. Whenever you use one of the API Methods in the interactive documentation, it will display the corresponding request as a cURL command. This makes it easy to copy, paste, and iterate the request.