Floors
You can use Butlr's GraphQL API to create, update, and retrieve information about floors.
A floor represents an individual level within a building and may contain one or more rooms and zones. Buildings can have one or multiple floors, depending on their structure and user requirements.
This page provides guidance on how to retrieve, create, and update floor information within a building, enabling precise management of floor-specific data.
First, obtain an access token to get started here.
Get all floors
query allFloors {
floors {
data {
id
building {
id
name
}
metadata {
...MetaDataFragment
}
name
timezone
area {
...AreaFragment
}
capacity {
...CapacityFragment
}
sensors {
id
name
...SensorFragment
}
hives {
id
name
...HiveFragment
}
rooms {
id
name
...RoomFragment
}
zones {
id
name
...ZoneFragment
}
installation_date
installation_status
tags {
id
name
...TagFragment
}
last_battery_change_date
next_battery_change_date
floor_plans {
...FloorPlanFragment
}
floorNumber
client_id
}
}
}
Code Examples
curl --location 'https://api.butlr.io/api/v3/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer [insert access_token here]' \
--data '{"query":"query allFloors{\n floors{\n data {\n id\n building {\n id\n name\n }\n name\n timezone\n sensors {\n sensor_id\n name\n }\n hives {\n id\n name\n }\n rooms {\n id\n name\n }\n zones {\n id\n name\n }\n }\n }\n}","variables":{}}'
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.butlr.io/api/v3/graphql"
method := "POST"
payload := strings.NewReader("{\"query\":\"query allFloors{\\n floors{\\n data {\\n id\\n building {\\n id\\n name\\n }\\n name\\n timezone\\n sensors {\\n sensor_id\\n name\\n }\\n hives {\\n id\\n name\\n }\\n rooms {\\n id\\n name\\n }\\n zones {\\n id\\n name\\n }\\n }\\n }\\n}\",\"variables\":{}}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer [insert access_token here]")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
import requests
import json
url = "https://api.butlr.io/api/v3/graphql"
payload = "{\"query\":\"query allFloors{\\n floors{\\n data {\\n id\\n building {\\n id\\n name\\n }\\n name\\n timezone\\n sensors {\\n sensor_id\\n name\\n }\\n hives {\\n id\\n name\\n }\\n rooms {\\n id\\n name\\n }\\n zones {\\n id\\n name\\n }\\n }\\n }\\n}\",\"variables\":{}}"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer [insert access_token here]'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Update floor(s)
mutation updateFloorInfo($input: UpdateFloorInfoInput!) {
updateFloorInfo(input: $input) {
floor {
id
name
}
}
}
# Variables
{
"input" : {
"name": "example_floor_updated_name",
"id": "space_2mAEeEfqHvPPoWMYoLuEUl6ncWn"
}
}
Code Examples
curl --location 'https://api.butlr.io/api/v3/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjJwTC04ZGRDNlhMaDNEblVHa2ptWiJ9.eyJodHRwOi8vYnV0bHIuaW8vY2xpZW50X2lkIjoiY2xpZW50XzJDbFlBYVY1Z0FISlJjUDdsd3JoTUU5ejR1WSIsImh0dHA6Ly9idXRsci5pby9lbWFpbCI6ImV2YWxfMjUxMzMzQGJ1dGxyLnRlY2giLCJodHRwOi8vYnV0bHIuaW8vcm9sZXMiOltdLCJpc3MiOiJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8dXNlcl8yQ2xZQVpTZjZlMzJVUFRrVVBSUUplTWhLbkciLCJhdWQiOlsiaHR0cHM6Ly91c2Vycy5idXRsci5pby8iLCJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNzI2NTExNTA4LCJleHAiOjE3MjY1MTI1MDgsInNjb3BlIjoib3BlbmlkIGVtYWlsIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MiLCJndHkiOiJwYXNzd29yZCIsImF6cCI6Imw0bHh3MUsySjlQdUJ2UEZlNXlidkoyejhUNjBNc0pJIiwicGVybWlzc2lvbnMiOltdfQ.k15h6wL5qz6zZrLLLdJ7_dsBrDvtO1J0veqUPzQjzKQ73fHDfidKf3MFNBq694z-NWQA-5Usf-Ck62EJ0POyE4PcZ7ptN42NgyeGD0EB40aDMEmYW_kxXvf8iewpbtBMVjqsIwHOR5YG8pE4VMXDrhPmRdSaurg0ic8kLRhqXGSHAzVqVtGXkVMmy9TXsVsDw-e3GymiJzLgm8S0zhzfBNLbffTgL4h3v4-nQC8hmUraNi3aQLQa4sYBvREV9IKECwNWfAXFWlckn3YC3s_90UOlWL4aFAc-tGTrUJyPDtytrunlegulFEeVDANe71nXnh1yBqLiHuiBNDryD2BqWQ' \
--data '{"query":"mutation updateFloorInfo($input: UpdateFloorInfoInput!) {\n updateFloorInfo(input: $input) {\n floor {\n id\n name\n }\n }\n}","variables":{"input":{"name":"example_floor_updated_name","id":"space_2mAEeEfqHvPPoWMYoLuEUl6ncWn"}}}'
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.butlr.io/api/v3/graphql"
method := "POST"
payload := strings.NewReader("{\"query\":\"mutation updateFloorInfo($input: UpdateFloorInfoInput!) {\\n updateFloorInfo(input: $input) {\\n floor {\\n id\\n name\\n }\\n }\\n}\",\"variables\":{\"input\":{\"name\":\"example_floor_updated_name\",\"id\":\"space_2mAEeEfqHvPPoWMYoLuEUl6ncWn\"}}}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjJwTC04ZGRDNlhMaDNEblVHa2ptWiJ9.eyJodHRwOi8vYnV0bHIuaW8vY2xpZW50X2lkIjoiY2xpZW50XzJDbFlBYVY1Z0FISlJjUDdsd3JoTUU5ejR1WSIsImh0dHA6Ly9idXRsci5pby9lbWFpbCI6ImV2YWxfMjUxMzMzQGJ1dGxyLnRlY2giLCJodHRwOi8vYnV0bHIuaW8vcm9sZXMiOltdLCJpc3MiOiJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8dXNlcl8yQ2xZQVpTZjZlMzJVUFRrVVBSUUplTWhLbkciLCJhdWQiOlsiaHR0cHM6Ly91c2Vycy5idXRsci5pby8iLCJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNzI2NTExNTA4LCJleHAiOjE3MjY1MTI1MDgsInNjb3BlIjoib3BlbmlkIGVtYWlsIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MiLCJndHkiOiJwYXNzd29yZCIsImF6cCI6Imw0bHh3MUsySjlQdUJ2UEZlNXlidkoyejhUNjBNc0pJIiwicGVybWlzc2lvbnMiOltdfQ.k15h6wL5qz6zZrLLLdJ7_dsBrDvtO1J0veqUPzQjzKQ73fHDfidKf3MFNBq694z-NWQA-5Usf-Ck62EJ0POyE4PcZ7ptN42NgyeGD0EB40aDMEmYW_kxXvf8iewpbtBMVjqsIwHOR5YG8pE4VMXDrhPmRdSaurg0ic8kLRhqXGSHAzVqVtGXkVMmy9TXsVsDw-e3GymiJzLgm8S0zhzfBNLbffTgL4h3v4-nQC8hmUraNi3aQLQa4sYBvREV9IKECwNWfAXFWlckn3YC3s_90UOlWL4aFAc-tGTrUJyPDtytrunlegulFEeVDANe71nXnh1yBqLiHuiBNDryD2BqWQ")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
import requests
import json
url = "https://api.butlr.io/api/v3/graphql"
payload = "{\"query\":\"mutation updateFloorInfo($input: UpdateFloorInfoInput!) {\\n updateFloorInfo(input: $input) {\\n floor {\\n id\\n name\\n }\\n }\\n}\",\"variables\":{\"input\":{\"name\":\"example_floor_updated_name\",\"id\":\"space_2mAEeEfqHvPPoWMYoLuEUl6ncWn\"}}}"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjJwTC04ZGRDNlhMaDNEblVHa2ptWiJ9.eyJodHRwOi8vYnV0bHIuaW8vY2xpZW50X2lkIjoiY2xpZW50XzJDbFlBYVY1Z0FISlJjUDdsd3JoTUU5ejR1WSIsImh0dHA6Ly9idXRsci5pby9lbWFpbCI6ImV2YWxfMjUxMzMzQGJ1dGxyLnRlY2giLCJodHRwOi8vYnV0bHIuaW8vcm9sZXMiOltdLCJpc3MiOiJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8dXNlcl8yQ2xZQVpTZjZlMzJVUFRrVVBSUUplTWhLbkciLCJhdWQiOlsiaHR0cHM6Ly91c2Vycy5idXRsci5pby8iLCJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNzI2NTExNTA4LCJleHAiOjE3MjY1MTI1MDgsInNjb3BlIjoib3BlbmlkIGVtYWlsIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MiLCJndHkiOiJwYXNzd29yZCIsImF6cCI6Imw0bHh3MUsySjlQdUJ2UEZlNXlidkoyejhUNjBNc0pJIiwicGVybWlzc2lvbnMiOltdfQ.k15h6wL5qz6zZrLLLdJ7_dsBrDvtO1J0veqUPzQjzKQ73fHDfidKf3MFNBq694z-NWQA-5Usf-Ck62EJ0POyE4PcZ7ptN42NgyeGD0EB40aDMEmYW_kxXvf8iewpbtBMVjqsIwHOR5YG8pE4VMXDrhPmRdSaurg0ic8kLRhqXGSHAzVqVtGXkVMmy9TXsVsDw-e3GymiJzLgm8S0zhzfBNLbffTgL4h3v4-nQC8hmUraNi3aQLQa4sYBvREV9IKECwNWfAXFWlckn3YC3s_90UOlWL4aFAc-tGTrUJyPDtytrunlegulFEeVDANe71nXnh1yBqLiHuiBNDryD2BqWQ'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Last updated