Sites

You can use Butlr's GraphQL API to create, update, and retrieve information about sites.

A site represents a group of buildings located within a contiguous area, such as a campus or city blocks, all within the same time zone. Organizations can manage one or multiple sites depending on their needs.

This page provides guidance on how to retrieve, create, and update site information within an organization, enabling efficient management of site-related data and ensuring seamless operations across locations.

First, obtain an access token to get started here.


Get all site(s)

query allSites {
  sites {
      data {
        id
        name
        buildings {
          id
          name
          ...BuildingFragment
        }
        siteNumber
        customID
        timezone
    }
  }
}

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 allSites {\n  sites {\n      data {\n        id\n        name\n        buildings {\n            id\n            name\n        }\n        siteNumber\n        customID\n        timezone\n    }\n  }\n}","variables":{}}'

Update site(s)

mutation updateSiteInfo($input: UpdateSiteInfoInput!) {
  updateSiteInfo(input: $input) {
    site {
      id
      name
      siteNumber

      timezone
    }
  }
}

# Variables
{
    "input" :{
        "name": "example_site_updated_name",
        "id": "site_2mA7CiVpUluJ4rz5MxhfxNAH3PT"
    }
}

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 updateSiteInfo($input: UpdateSiteInfoInput!) {\n  updateSiteInfo(input: $input) {\n    site {\n      id\n      name\n      siteNumber\n      timezone\n    }\n  }\n}","variables":{"input":{"name":"example_site_updated_name","id":"site_2mA7CiVpUluJ4rz5MxhfxNAH3PT"}}}'

Last updated