Skip to content

GraphQL Code Examples

Filter spaces and elements by customId

This example shows how to query spaces and elements that have a custom ID set (non-null).

graphql
query ($layoutId: ID!) {
  getLayoutById(id: $layoutId) {
    elements(where: { customId: { null: false } }) {
      id
      customId
    }
    spaces(where: { customId: { null: false } }) {
      id
      name
      category
      subCategory
      customId
    }
  }
}

GraphQL connectivity graph with D3

This example uses the GraphQL API to fetch space and door relations, then builds a connectivity graph using D3 force-directed layout.

The query retrieves spaces with their doors, then processes the data to create nodes (spaces) and links (connections via shared doors).

graphql
query GetFloorSpaces($floorId: ID!) {
  getFloorById(id: $floorId) {
    spaces {
      category
      subCategory
      id
      elements(where: { type: { in ["element:door", "element:spaceDivider" ] }) {
        id
      }
    }
  }
}