Sensors
You can use Butlr's GraphQL API to create, update, and retrieve sensor information.
A sensor can be associated with a floor, room, or zone. This flexibility allows for effective monitoring across different areas, from general traffic at floor entrances to pinpointing specific occupancy locations within a zone.
This page provides guidance on how to retrieve, create, and update sensor information within an organization.
First, obtain an access token to get started here.
Get all sensors
query allSensors {
sensors {
data {
client_id
floor_id
room_id
hive_id
hive_serial
sensor_id
name
mac_address
mode
model
sensitivity
center
height
orientation
field_of_view
}
}
}
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 allSensors {\n sensors {\n data {\n client_id\n floor_id\n room_id\n hive_id\n hive_serial\n sensor_id\n name\n mac_address\n mode\n model\n sensitivity\n center\n height\n orientation\n field_of_view\n }\n }\n}","variables":{}}'
Create sensor(s)
mutation createSensor($sensor: CreateSensorInput!) {
createSensors(sensors: [$sensor]) {
sensor_id
name
mac_address
}
}
# Variables
{
"sensor": {
"name": "new_sensor_name",
"mac_address": "placeholder_mac"
}
}
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":"mutation createSensor($sensor: CreateSensorInput!) {\n createSensors(sensors: [$sensor]) {\n sensor_id\n name\n mac_address\n }\n}","variables":{"sensor":{"name":"new_sensor_name","mac_address":"placeholder_mac"}}}'
Update sensor(s)
mutation updateSensors($sensor: UpdateSensorInput!) {
updateSensors(sensors: [$sensor]) {
client_id
floor_id
room_id
hive_id
hive_serial
sensor_id
name
mac_address
mode
model
sensitivity
center
height
orientation
field_of_view
}
}
# Variables
{
"sensor": {
"sensor_id": "sensor_2k53witHHhYxj7iMK4qdefI5zoO",
"name": "updated_sensor_name"
}
}
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":"mutation updateSensors($sensor: UpdateSensorInput!) {\n updateSensors(sensors: [$sensor]) {\n sensor_id\n name\n }\n}","variables":{"sensor":{"sensor_id":"sensor_2k53witHHhYxj7iMK4qdefI5zoO","name":"updated_sensor_name"}}}'
Last updated