Appearance
Custom attributes
Definitions
Custom attribute definitions are stored uniquely for each resource type and organization, each accompanied by its own schema and offering complete user-defined configurability.
Currently supported resource types: Floor
, Space
, Asset
, Product
and input types: Boolean
, Number
, Integer
, Text
, Select
.
The simplest way to create and manage the definitions is via the Dashboard settings.
Alternatively they can also be created and updated via API. The input types shown in the frontend correspond to the following JSON schemas:
Input type | Schema |
---|---|
Boolean | { "type": "boolean" } |
Number | { "type": "number" } |
Integer | { "type": "integer" } |
Text | { "type": "string" } |
Select | { "type": "string", "enum": [] } |
Example of registering a custom attribute with the apiFieldName
'department' for the resource type Space
.
Corresponding post method.
ts
{
apiFieldName: 'department',
description: 'Defines the department the space belongs to.',
title: 'Department',
valueType: 'Schema',
schema: { type: 'string', enum: ['Revenue', 'Product', 'Operations'] }
}
Values
Setting custom attribute values for a specific resource by resourceId
and apiFieldName
, in this case a specific space.
with the operations endpoint. To remove a value set it to null
.
ts
{
type: 'operation:spaceUpdate'
nodeId: '<space-id>'
value: {
customAttributes: {
'department': 'Product'
}
}
}
Querying
The GraphQL endpoint allows you to query resources by the occurance of custom attribute values or filter for specific values. Note that the custom attribute definition's apiFieldName
equals the custom attribute value's key
.
graphql
query Floors {
getFloors {
floors(
where: { customAttributes: { key: { eq: "building-id" }, value: { eq: "ZURICH-01" } } }
) {
id
name
}
}
}