### Get All Floors Python Example Source: https://docs.butlr.io/asset-management/graphql-api-overview/floors Shows how to retrieve all floor data using Python's requests library. This snippet details the POST request setup, including the GraphQL query payload and headers, with a placeholder for the access token. ```Python 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) ``` -------------------------------- ### GraphQL: List Webhooks Example Source: https://docs.butlr.io/real-time-occupancy/manage-webhooks Example GraphQL query to retrieve a list of all configured webhooks, including their details and endpoint configurations. ```graphql query { webhooks { id name event_types endpoint_config { url http_timeout api_key { key value } basic_auth { username password } } } } ``` -------------------------------- ### Get All Floors Go Example Source: https://docs.butlr.io/asset-management/graphql-api-overview/floors Provides a Go program to retrieve all floor data from the Butlr API. It illustrates setting up an HTTP client, constructing the request payload with the GraphQL query, and handling the response. An access token is required in the Authorization header. ```Go 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)) } ``` -------------------------------- ### GraphQL: Create Webhooks Example Source: https://docs.butlr.io/real-time-occupancy/manage-webhooks Example GraphQL mutation for creating new webhooks. It demonstrates how to structure the input payload with event types and endpoint configurations. ```graphql mutation CreateWebhooks ($input: [WebhookCreateInput!]!) { createWebhooks(input: $input) { id name event_types endpoint_config { url http_timeout api_key { key value } basic_auth { username password } } } } ``` -------------------------------- ### Get All Floors cURL Example Source: https://docs.butlr.io/asset-management/graphql-api-overview/floors Demonstrates how to fetch all floor data using a cURL command. This example shows the HTTP POST request structure, including the GraphQL query and necessary headers like Content-Type and Authorization with an access token. ```cURL 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":{}}' ``` -------------------------------- ### Zone Occupancy Event Payload Example Source: https://docs.butlr.io/real-time-occupancy/webhooks-overview/zone-occupancy An example of the JSON payload structure for the Zone Occupancy webhook event. It includes identifiers, timestamps, metadata about the organization and location, and the actual occupancy data. ```json { "id": "event_2oUBiSXgx48RtbZKXHm5ekpAzFe", "type": "ZONE_OCCUPANCY", "timestamp": 1727735832000, "version": "v1.0.0", "metadata": { "org_id": "org_2oUBiRES2AmpczNM5yLu7pChz8o", "site_id": "site_2oUBkdxF0lLJZxyWVix09ZTsMNV", "building_id": "building_2oUBkaFkcYwDzo7HLXpPh8bP4cD", "floor_id": "space_2oUBnI7YL51GNemTvKIxEgSZ8gx", "room_id": "room_2oUDDps5iKHHo6RwlMgGVihmTlq", "zone_id": "zone_2oUJLGKGlqPjwnUCwXNXpX3HB28", "floor_custom_id": "2tZStWPtxqpmb3w0PoJDm7AnfIX", "room_custom_id": "2tZSGplhA4CZ58wFlTf7wAeKMVo", "zone_custom_id": "2tZTBBPk0Xmmo8zl1zFXrBHZwsz", "org_name": "Murphy Group", "site_name": "Los Angeles", "building_name": "Bergnaum Building", "floor_name": "1st Floor", "room_name": "Cherry Falls", "zone_name": "Desk 01" }, "data": 4 } ``` -------------------------------- ### Webhook Update API Response Example Source: https://docs.butlr.io/real-time-occupancy/manage-webhooks/update-webhooks An example of a successful API response when updating webhooks, showing the structure of the returned data including webhook IDs, names, event types, and endpoint configurations. ```APIDOC GraphQL API Response: updateWebhooks(input: WebhookInput[]): WebhookUpdateResponse WebhookUpdateResponse: data: WebhookUpdatePayload WebhookUpdatePayload: updateWebhooks: Webhook[] Webhook: id: String name: String event_types: [String] endpoint_config: EndpointConfig EndpointConfig: url: String http_timeout: Int api_key: ApiKeyConfig basic_auth: BasicAuthConfig ApiKeyConfig: key: String value: String BasicAuthConfig: username: String password: String Example Response Structure: { "data": { "updateWebhooks": [ { "id": "webhook_2oqujQF2pRZO8BqPgT8dWkf4Swb", "name": "My Webhook", "event_types": ["FLOOR_OCCUPANCY"], "endpoint_config": { "url": "https://customer.api.com/webhooks", "http_timeout": 10, "api_key": { "key": "x-api-key", "value": "akfsdl;jf;alksjdfiuhwiefhsks" }, "basic_auth": { "username": "bob", "password": "letmein" } } }, { "id": "webhook_2oqujRtbTdX1KTA0olXvAtftGWA", "name": "Another Webhook", "event_types": ["ROOM_OCCUPANCY", "DETECTIONS"], "endpoint_config": { "url": "https://another.customer.api.com/webhooks", "http_timeout": 15, "api_key": null, "basic_auth": null } } ] } } ``` -------------------------------- ### PIR Motion Event JSON Example Source: https://docs.butlr.io/real-time-occupancy/webhooks-overview/motion-detection An example of the JSON payload received for a PIR Motion event, illustrating the structure and typical values for event and metadata fields. ```json { "id": "event_2oUBiSXgx48RtbZKXHm5ekpAzFe", "type": "PIR_MOTION", "timestamp": 1727735832000, "version": "v1.0.0", "metadata": { "org_id": "org_2oUBiRES2AmpczNM5yLu7pChz8o", "site_id": "site_2oUBkdxF0lLJZxyWVix09ZTsMNV", "building_id": "building_2oUBkaFkcYwDzo7HLXpPh8bP4cD", "floor_id": "space_2oUBnI7YL51GNemTvKIxEgSZ8gx", "room_id": "room_2oUDDps5iKHHo6RwlMgGVihmTlq", "floor_custom_id": "2tZStWPtxqpmb3w0PoJDm7AnfIX", "room_custom_id": "2tZSGplhA4CZ58wFlTf7wAeKMVo", "org_name": "Murphy Group", "site_name": "Los Angeles", "building_name": "Bergnaum Building", "floor_name": "1st Floor", "room_name": "Cherry Falls" } } ``` -------------------------------- ### Fetch Room Data from butlr.io API via GraphQL Source: https://docs.butlr.io/asset-management/graphql-api-overview/rooms Demonstrates how to query room information from the butlr.io GraphQL API. It includes examples for making the POST request with necessary headers and a GraphQL query payload. The examples cover cURL, Go, and Python. ```bash 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":"query allRooms{\n rooms {\n data {\n id\n name\n floor {\n id\n name\n }\n capacity {\n max\n mid\n }\n rotation\n roomType\n sensors {\n sensor_id\n name\n }\n }\n }\n}","variables":{}}' ``` ```go 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 allRooms{\\n rooms {\\n data {\\n id\\n name\\n floor {\\n id\\n name\\n }\\n capacity {\\n max\\n mid\\n }\\n rotation\\n roomType\\n sensors {\\n sensor_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 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)) } ``` ```python import requests import json url = "https://api.butlr.io/api/v3/graphql" payload = "{\"query\":\"query allRooms{\\n rooms {\\n data {\\n id\\n name\\n floor {\\n id\\n name\\n }\\n capacity {\\n max\\n mid\\n }\\n rotation\\n roomType\\n sensors {\\n sensor_id\\n name\\n }\\n }\\n }\\n}\",\"variables\":{}}" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjJwTC04ZGRDNlhMaDNEblVHa2ptWiJ9.eyJodHRwOi8vYnV0bHIuaW8vY2xpZW50X2lkIjoiY2xpZW50XzJDbFlBYVY1Z0FISlJjUDdsd3JoTUU5ejR1WSIsImh0dHA6Ly9idXRsci5pby9lbWFpbCI6ImV2YWxfMjUxMzMzQGJ1dGxyLnRlY2giLCJodHRwOi8vYnV0bHIuaW8vcm9sZXMiOltdLCJpc3MiOiJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8dXNlcl8yQ2xZQVpTZjZlMzJVUFRrVVBSUUplTWhLbkciLCJhdWQiOlsiaHR0cHM6Ly91c2Vycy5idXRsci5pby8iLCJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNzI2NTExNTA4LCJleHAiOjE3MjY1MTI1MDgsInNjb3BlIjoib3BlbmlkIGVtYWlsIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MiLCJndHkiOiJwYXNzd29yZCIsImF6cCI6Imw0bHh3MUsySjlQdUJ2UEZlNXlidkoyejhUNjBNc0pJIiwicGVybWlzc2lvbnMiOltdfQ.k15h6wL5qz6zZrLLLdJ7_dsBrDvtO1J0veqUPzQjzKQ73fHDfidKf3MFNBq694z-NWQA-5Usf-Ck62EJ0POyE4PcZ7ptN42NgyeGD0EB40aDMEmYW_kxXvf8iewpbtBMVjqsIwHOR5YG8pE4VMXDrhPmRdSaurg0ic8kLRhqXGSHAzVqVtGXkVMmy9TXsVsDw-e3GymiJzLgm8S0zhzfBNLbffTgL4h3v4-nQC8hmUraNi3aQLQa4sYBvREV9IKECwNWfAXFWlckn3YC3s_90UOlWL4aFAc-tGTrUJyPDtytrunlegulFEeVDANe71nXnh1yBqLiHuiBNDryD2BqWQ' } response = requests.post(url, headers=headers, data=payload) print(response.text) ``` -------------------------------- ### Create Sensor via GraphQL API Source: https://docs.butlr.io/asset-management/graphql-api-overview/sensors Provides examples for creating a new sensor via the Butlr.io GraphQL API. This functionality requires authentication and sends sensor data in the request payload. Examples are shown for cURL, Go, and Python. ```bash 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"}}}' ``` -------------------------------- ### Create Sensor via GraphQL API Source: https://docs.butlr.io/asset-management/graphql-api-overview/sensors Provides examples for creating a new sensor via the Butlr.io GraphQL API. This functionality requires authentication and sends sensor data in the request payload. Examples are shown for cURL, Go, and Python. ```go 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 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\"}}}") 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)) } ``` -------------------------------- ### Example Response for Webhook Creation Source: https://docs.butlr.io/real-time-occupancy/manage-webhooks/create-webhooks Illustrates the structure of a successful response from the `createWebhooks` GraphQL mutation. It shows the returned webhook IDs, names, event types, and the configured endpoint details, including authentication information if provided. ```json { "data": { "createWebhooks": [ { "id": "webhook_2oqujQF2pRZO8BqPgT8dWkf4Swb", "name": "My Webhook", "event_types": ["FLOOR_OCCUPANCY"], "endpoint_config": { "url": "https://customer.api.com/webhooks", "http_timeout": 10, "api_key": { "key": "x-api-key", "value": "akfsdl;jf;alksjdfiuhwiefhsks" }, "basic_auth": { "username": "bob", "password": "letmein" } } }, { "id": "webhook_2oqujRtbTdX1KTA0olXvAtftGWA", "name": "Another Webhook", "event_types": ["ROOM_OCCUPANCY", "DETECTIONS"], "endpoint_config": { "url": "https://another.customer.api.com/webhooks", "http_timeout": 15, "api_key": null, "basic_auth": null } } ] } } ``` -------------------------------- ### Get All Zones via Butlr.io GraphQL API Source: https://docs.butlr.io/asset-management/graphql-api-overview/zones This snippet demonstrates how to query all zones from the Butlr.io API using GraphQL. It includes the GraphQL query structure and examples of how to execute this query using cURL, Go, and Python. The query retrieves zone details, including ID, name, associated sensors, and location information. ```graphql query allZones { zones { data { id metadata { ...MetaDataFragment } name area { ...AreaFragment } coordinates rotation capacity { ...CapacityFragment } sensors { id name ...SensorFragment } note customID tags { id name ...TagFragment } client_id floor_id room_id zone_id } } } ``` ```bash curl --location 'https://api.butlr.io/api/v3/graphql' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjJwTC04ZGRDNlhMaDNEblVHa2ptWiJ9.eyJodHRwOi8vYnV0bHIuaW8vY2xpZW50X2lkIjoiY2xpZW50XzJDbFlBYVY1Z0FISlJjUDdsd3JoTUU5ejR1WSIsImh0dHA6Ly9idXRsci5pby9lbWFpbCI6ImV2YWxfMjUxMzMzQGJ1dGxyLnRlY2giLCJodHRwOi8vYnV0bHIuaW8vcm9sZXMiOltdLCJpc3MiOiJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8dXNlcl8yQ2xZQVpTZjZlMzJVUFRrVVBSUUplTWhLbkciLCJhdWQiOlsiaHR0cHM6Ly91c2Vycy5idXRsci5pby8iLCJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNzI2NTI1MDAwLCJleHAiOjE3MjY1MjYwMDAsInNjb3BlIjoib3BlbmlkIGVtYWlsIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MiLCJndHkiOiJwYXNzd29yZCIsImF6cCI6Imw0bHh3MUsySjlQdUJ2UEZlNXlidkoyejhUNjBNc0pJIiwicGVybWlzc2lvbnMiOltdfQ.kp9BDRkay9YhoKngkokY44bXynD3Gcrh0IwPQVtVZIbX76yDTZpNCuj1kRhK7tdQ7Kfkakk60sjpOJ4bmbjxKPBPiFUSKvySUGWuAKCx3-l2zvfy49wB0KC9xHKT2x_HXfaDxgxL7v8DwO0zGF0TXsV9vf45lAkYzMsf-YXQeK4SId5gF09g1xHnS_WNZaliUzZhrGQQxzdyJL1ns5NH9NBk1SumEUzo1YpRxeEvxBL0zDCU2NslgKpNlkEPwcGNNIWfitfa5y871wLoYCNgjyesEW-Pin76L4BBLw4LK8TnulFUZM5GLbDnk3h-02qa4jElDIQ4Gl6MbWx5piIq5w' \ --data '{"query":"query allZones {\n zones {\n data {\n id\n name\n sensors {\n sensor_id\n name\n }\n floor_id\n room_id\n zone_id\n zone_type\n }\n }\n}","variables":{}}' ``` ```go 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 allZones {\n zones {\n data {\n id\n name\n sensors {\n sensor_id\n name\n }\n floor_id\n room_id\n zone_id\n zone_type\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 eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjJwTC04ZGRDNlhMaDNEblVHa2ptWiJ9.eyJodHRwOi8vYnV0bHIuaW8vY2xpZW50X2lkIjoiY2xpZW50XzJDbFlBYVY1Z0FISlJjUDdsd3JoTUU5ejR1WSIsImh0dHA6Ly9idXRsci5pby9lbWFpbCI6ImV2YWxfMjUxMzMzQGJ1dGxyLnRlY2giLCJodHRwOi8vYnV0bHIuaW8vcm9sZXMiOltdLCJpc3MiOiJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8dXNlcl8yQ2xZQVpTZjZlMzJVUFRrVVBSUUplTWhLbkciLCJhdWQiOlsiaHR0cHM6Ly91c2Vycy5idXRsci5pby8iLCJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNzI2NTI1MDAwLCJleHAiOjE3MjY1MjYwMDAsInNjb3BlIjoib3BlbmlkIGVtYWlsIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MiLCJndHkiOiJwYXNzd29yZCIsImF6cCI6Imw0bHh3MUsySjlQdUJ2UEZlNXlidkoyejhUNjBNc0pJIiwicGVybWlzc2lvbnMiOltdfQ.kp9BDRkay9YhoKngkokY44bXynD3Gcrh0IwPQVtVZIbX76yDTZpNCuj1kRhK7tdQ7Kfkakk60sjpOJ4bmbjxKPBPiFUSKvySUGWuAKCx3-l2zvfy49wB0KC9xHKT2x_HXfaDxgxL7v8DwO0zGF0TXsV9vf45lAkYzMsf-YXQeK4SId5gF09g1xHnS_WNZaliUzZhrGQQxzdyJL1ns5NH9NBk1SumEUzo1YpRxeEvxBL0zDCU2NslgKpNlkEPwcGNNIWfitfa5y871wLoYCNgjyesEW-Pin76L4BBLw4LK8TnulFUZM5GLbDnk3h-02qa4jElDIQ4Gl6MbWx5piIq5w") 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)) } ``` ```python import requests import json url = "https://api.butlr.io/api/v3/graphql" payload = "{\"query\":\"query allZones {\n zones {\n data {\n id\n name\n sensors {\n sensor_id\n name\n }\n floor_id\n room_id\n zone_id\n zone_type\n }\n }\n}\",\"variables\":{}}" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjJwTC04ZGRDNlhMaDNEblVHa2ptWiJ9.eyJodHRwOi8vYnV0bHIuaW8vY2xpZW50X2lkIjoiY2xpZW50XzJDbFlBYVY1Z0FISlJjUDdsd3JoTUU5ejR1WSIsImh0dHA6Ly9idXRsci5pby9lbWFpbCI6ImV2YWxfMjUxMzMzQGJ1dGxyLnRlY2giLCJodHRwOi8vYnV0bHIuaW8vcm9sZXMiOltdLCJpc3MiOiJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8dXNlcl8yQ2xZQVpTZjZlMzJVUFRrVVBSUUplTWhLbkciLCJhdWQiOlsiaHR0cHM6Ly91c2Vycy5idXRsci5pby8iLCJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNzI2NTI1MDAwLCJleHAiOjE3MjY1MjYwMDAsInNjb3BlIjoib3BlbmlkIGVtYWlsIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MiLCJndHkiOiJwYXNzd29yZCIsImF6cCI6Imw0bHh3MUsySjlQdUJ2UEZlNXlidkoyejhUNjBNc0pJIiwicGVybWlzc2lvbnMiOltdfQ.kp9BDRkay9YhoKngkokY44bXynD3Gcrh0IwPQVtVZIbX76yDTZpNCuj1kRhK7tdQ7Kfkakk60sjpOJ4bmbjxKPBPiFUSKvySUGWuAKCx3-l2zvfy49wB0KC9xHKT2x_HXfaDxgxL7v8DwO0zGF0TXsV9vf45lAkYzMsf-YXQeK4SId5gF09g1xHnS_WNZaliUzZhrGQQxzdyJL1ns5NH9NBk1SumEUzo1YpRxeEvxBL0zDCU2NslgKpNlkEPwcGNNIWfitfa5y871wLoYCNgjyesEW-Pin76L4BBLw4LK8TnulFUZM5GLbDnk3h-02qa4jElDIQ4Gl6MbWx5piIq5w'} response = requests.post(url, data=payload, headers=headers) print(response.text) ``` -------------------------------- ### Butlr Webhook Setup Source: https://docs.butlr.io/readme Instructions on setting up event-triggered webhooks for real-time data delivery from the Butlr platform. This enables immediate notification of occupancy changes and other events. ```APIDOC Webhooks: Set up event-triggered webhooks for real-time data delivery. Facilitates immediate notifications for occupancy changes and other platform events. ``` -------------------------------- ### GraphQL: Delete Webhooks Example Source: https://docs.butlr.io/real-time-occupancy/manage-webhooks Example GraphQL mutation for deleting webhooks. It takes a list of webhook IDs as input. ```graphql mutation DeleteWebhooks ($input: [ID!]!) { deleteWebhooks(ids: $input) } ``` -------------------------------- ### GraphQL: Update Webhooks Example Source: https://docs.butlr.io/real-time-occupancy/manage-webhooks Example GraphQL mutation for updating existing webhooks. It shows how to specify the webhook ID and the fields to be modified. ```graphql mutation UpdateWebhooks ($input: [WebhookUpdateInput!]!) { updateWebhooks(input: $input) { id name event_types endpoint_config { url http_timeout api_key { key value } basic_auth { username password } } } } ```