Reference
Floors
Levels within a building.
A floor belongs to a building and holds rooms. A single-storey plant still has one — usually called something like “Production hall” with level 0 — because rooms have to hang off something.
The floor object
iduuid- Opaque.
objectstring- Always "floor".
building_iduuid- The building.
namestring- Display name.
levelinteger- Storey number. 0 is ground; basements are negative.
created_attimestamp- ISO 8601, UTC.
updated_attimestamp- ISO 8601, UTC.
{
"id": "0a6e524a-198c-4390-ab12-cd34efb7d41f",
"object": "floor",
"building_id": "1f0a6e52-4a19-8c33-90ab-12cd34efb7d4",
"name": "Production hall",
"level": 0,
"created_at": "2023-01-15T08:05:00.000Z",
"updated_at": "2023-01-15T08:05:00.000Z"
}Endpoints
List a building's floors
GET
/buildings/{buildingId}/floorsScope
floors:readPaginatedPath parameters
buildingIduuidrequired- The building.
Accepts limit and cursor. See Pagination.
curl https://nexa.com.tn/api/v1/buildings/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/floors \
-H "Authorization: Bearer $NEXA_API_KEY"const response = await fetch(
"https://nexa.com.tn/api/v1/buildings/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/floors",
{
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/buildings/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/floors",
headers=headers,
)
response.raise_for_status()
data = response.json()["data"]Response
GET /v1/buildings/{buildingId}/floors
{
"data": [
{
"id": "0a6e524a-198c-4390-ab12-cd34efb7d41f",
"object": "floor",
"building_id": "1f0a6e52-4a19-8c33-90ab-12cd34efb7d4",
"name": "Production hall",
"level": 0,
"created_at": "2023-01-15T08:05:00.000Z",
"updated_at": "2023-01-15T08:05:00.000Z"
}
],
"pagination": {
"limit": 50,
"has_more": true,
"next_cursor": "eyJvIjo1MH0"
}
}Retrieve a floor
GET
/floors/{floorId}Scope
floors:readPath parameters
floorIduuidrequired- The floor.
curl https://nexa.com.tn/api/v1/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef \
-H "Authorization: Bearer $NEXA_API_KEY"const response = await fetch(
"https://nexa.com.tn/api/v1/floors/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/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef",
headers=headers,
)
response.raise_for_status()
data = response.json()["data"]Response
GET /v1/floors/{floorId}
{
"data": {
"id": "0a6e524a-198c-4390-ab12-cd34efb7d41f",
"object": "floor",
"building_id": "1f0a6e52-4a19-8c33-90ab-12cd34efb7d4",
"name": "Production hall",
"level": 0,
"created_at": "2023-01-15T08:05:00.000Z",
"updated_at": "2023-01-15T08:05:00.000Z"
}
}Create a floor
POST
/buildings/{buildingId}/floorsScope
floors:writePath parameters
buildingIduuidrequired- The building.
Body
namestringrequired- Display name.
levelintegerrequired- Storey number.
curl -X POST https://nexa.com.tn/api/v1/buildings/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/floors \
-H "Authorization: Bearer $NEXA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Mezzanine",
"level": 1
}'const response = await fetch(
"https://nexa.com.tn/api/v1/buildings/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/floors",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.NEXA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Mezzanine",
"level": 1
}),
},
);
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/buildings/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef/floors",
headers=headers,
json={
"name": "Mezzanine",
"level": 1
},
)
response.raise_for_status()
data = response.json()["data"]Response
POST /v1/buildings/{buildingId}/floors
{
"data": {
"id": "0a6e524a-198c-4390-ab12-cd34efb7d41f",
"object": "floor",
"building_id": "1f0a6e52-4a19-8c33-90ab-12cd34efb7d4",
"name": "Production hall",
"level": 0,
"created_at": "2023-01-15T08:05:00.000Z",
"updated_at": "2023-01-15T08:05:00.000Z"
}
}Update a floor
PATCH
/floors/{floorId}Scope
floors:writePath parameters
floorIduuidrequired- The floor.
Body
namestring- Display name.
levelinteger- Storey number.
curl -X PATCH https://nexa.com.tn/api/v1/floors/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/floors/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/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef",
headers=headers,
json={},
)
response.raise_for_status()
data = response.json()["data"]Response
PATCH /v1/floors/{floorId}
{
"data": {
"id": "0a6e524a-198c-4390-ab12-cd34efb7d41f",
"object": "floor",
"building_id": "1f0a6e52-4a19-8c33-90ab-12cd34efb7d4",
"name": "Production hall",
"level": 0,
"created_at": "2023-01-15T08:05:00.000Z",
"updated_at": "2023-01-15T08:05:00.000Z"
}
}Delete a floor
DELETE
/floors/{floorId}Scope
floors:deletePath parameters
floorIduuidrequired- The floor.
curl -X DELETE https://nexa.com.tn/api/v1/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef \
-H "Authorization: Bearer $NEXA_API_KEY"const response = await fetch(
"https://nexa.com.tn/api/v1/floors/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/floors/b7d41f0a-6e52-4a19-8c33-90ab12cd34ef",
headers=headers,
)
response.raise_for_status()Returns 204 No Content with an empty body.