Reference
Rooms
Rooms and zones — where an asset actually is.
A room is the finest location in the hierarchy and the one an asset is attached to. In a plant it is usually a line or a zone rather than a walled room; in an office building it is a room.
The room object
iduuid- Opaque.
objectstring- Always "room".
floor_iduuid- The floor.
namestring- Display name.
created_attimestamp- ISO 8601, UTC.
updated_attimestamp- ISO 8601, UTC.
{
"id": "6e524a19-8c33-90ab-12cd-34efb7d41f0a",
"object": "room",
"floor_id": "0a6e524a-198c-4390-ab12-cd34efb7d41f",
"name": "Line 2",
"created_at": "2023-01-15T08:07:00.000Z",
"updated_at": "2023-01-15T08:07:00.000Z"
}Endpoints
List a floor's rooms
GET
/floors/{floorId}/roomsScope
rooms:readPaginatedPath parameters
floorIduuidrequired- The floor.
Accepts limit and cursor. See Pagination.
curl https://nexa.com.tn/api/v1/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/rooms \
-H "Authorization: Bearer $NEXA_API_KEY"const response = await fetch(
"https://nexa.com.tn/api/v1/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/rooms",
{
headers: {
Authorization: `Bearer ${process.env.NEXA_API_KEY}`,
},
},
);
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['NEXA_API_KEY']}",
}
response = requests.get(
"https://nexa.com.tn/api/v1/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/rooms",
headers=headers,
)
response.raise_for_status()
data = response.json()["data"]Response
GET /v1/floors/{floorId}/rooms
{
"data": [
{
"id": "6e524a19-8c33-90ab-12cd-34efb7d41f0a",
"object": "room",
"floor_id": "0a6e524a-198c-4390-ab12-cd34efb7d41f",
"name": "Line 2",
"created_at": "2023-01-15T08:07:00.000Z",
"updated_at": "2023-01-15T08:07:00.000Z"
}
],
"pagination": {
"limit": 50,
"has_more": true,
"next_cursor": "eyJvIjo1MH0"
}
}Retrieve a room
GET
/rooms/{roomId}Scope
rooms:readPath parameters
roomIduuidrequired- The room.
curl https://nexa.com.tn/api/v1/rooms/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef \
-H "Authorization: Bearer $NEXA_API_KEY"const response = await fetch(
"https://nexa.com.tn/api/v1/rooms/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef",
{
headers: {
Authorization: `Bearer ${process.env.NEXA_API_KEY}`,
},
},
);
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['NEXA_API_KEY']}",
}
response = requests.get(
"https://nexa.com.tn/api/v1/rooms/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef",
headers=headers,
)
response.raise_for_status()
data = response.json()["data"]Response
GET /v1/rooms/{roomId}
{
"data": {
"id": "6e524a19-8c33-90ab-12cd-34efb7d41f0a",
"object": "room",
"floor_id": "0a6e524a-198c-4390-ab12-cd34efb7d41f",
"name": "Line 2",
"created_at": "2023-01-15T08:07:00.000Z",
"updated_at": "2023-01-15T08:07:00.000Z"
}
}Create a room
POST
/floors/{floorId}/roomsScope
rooms:writePath parameters
floorIduuidrequired- The floor.
Body
namestringrequired- Display name.
curl -X POST https://nexa.com.tn/api/v1/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/rooms \
-H "Authorization: Bearer $NEXA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Line 3"
}'const response = await fetch(
"https://nexa.com.tn/api/v1/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/rooms",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.NEXA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Line 3"
}),
},
);
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['NEXA_API_KEY']}",
}
response = requests.post(
"https://nexa.com.tn/api/v1/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/rooms",
headers=headers,
json={
"name": "Line 3"
},
)
response.raise_for_status()
data = response.json()["data"]Response
POST /v1/floors/{floorId}/rooms
{
"data": {
"id": "6e524a19-8c33-90ab-12cd-34efb7d41f0a",
"object": "room",
"floor_id": "0a6e524a-198c-4390-ab12-cd34efb7d41f",
"name": "Line 2",
"created_at": "2023-01-15T08:07:00.000Z",
"updated_at": "2023-01-15T08:07:00.000Z"
}
}Update a room
PATCH
/rooms/{roomId}Scope
rooms:writePath parameters
roomIduuidrequired- The room.
Body
namestring- Display name.
curl -X PATCH https://nexa.com.tn/api/v1/rooms/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef \
-H "Authorization: Bearer $NEXA_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(
"https://nexa.com.tn/api/v1/rooms/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef",
{
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.NEXA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
},
);
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['NEXA_API_KEY']}",
}
response = requests.patch(
"https://nexa.com.tn/api/v1/rooms/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef",
headers=headers,
json={},
)
response.raise_for_status()
data = response.json()["data"]Response
PATCH /v1/rooms/{roomId}
{
"data": {
"id": "6e524a19-8c33-90ab-12cd-34efb7d41f0a",
"object": "room",
"floor_id": "0a6e524a-198c-4390-ab12-cd34efb7d41f",
"name": "Line 2",
"created_at": "2023-01-15T08:07:00.000Z",
"updated_at": "2023-01-15T08:07:00.000Z"
}
}Delete a room
DELETE
/rooms/{roomId}Scope
rooms:deleteAssets in it are detached, not deleted.
Path parameters
roomIduuidrequired- The room.
curl -X DELETE https://nexa.com.tn/api/v1/rooms/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef \
-H "Authorization: Bearer $NEXA_API_KEY"const response = await fetch(
"https://nexa.com.tn/api/v1/rooms/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef",
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.NEXA_API_KEY}`,
},
},
);
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['NEXA_API_KEY']}",
}
response = requests.delete(
"https://nexa.com.tn/api/v1/rooms/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef",
headers=headers,
)
response.raise_for_status()Returns 204 No Content with an empty body.