Interface
Interface is designed to query for devices in complex relationships. Interface works with groups and objects, where groups are a grouping of devices and objects are a singular device. Queries can use *
as a wildcard to query for all devices or objects.
Query Interface
Currently, the Interface methods require the systemId to work. This id can be found under the info tab of the system. In addition to the systemId, blueprintIds are required for Interface to work.
let deviceInfo
try {
deviceInfo = await api.interface( systemId, blueprintId ).obj( deviceId ).get()
} catch ( ex ) {
// error handling
}
The systemId and blueprintId can be substituted with the blueprint alias and system alias. The above query will result in deviceInfo
having all of the information for the device. In addition to this,
let devicesInfo
try {
devicesInfo = await api.interface( systemId, blueprintId ).obj( '*' ).get()
} catch ( ex ) {
// error handling
}
will result in devicesInfo containing all the info for devices with blueprintId
. In addition, interface queries can chain on relationships.
let devicesInfo
try {
devicesInfo = await api.interface( systemId, blueprint ).obj( deviceId ).grp( relationshipAttributeName ).list()
} catch ( ex ) {
// error handling
}
devicesInfo
will result in all the devices that are in a many to one relationship with the device. Many to one relationships use group
and one to one relationships and specific devices use object
Interface methods
- list() - return all the devices with the blueprintId
- create( device ) - creates a device with the blueprintId
- get( id ) - return the device with the id
- delete( id ) - deletes the device with the id
- obj( id ) - returns an instance of
object
- model() - returns the blueprint
object methods
- get() - gets the device
- update( patchOps ) - updates the devices information
- delete() - deletes the device
- create( device ) - creates a device with a one to one relationships
- grp( relationship ) - returns and instance of a
group
- obj( id ) - returns an instance of an
object
- users() - results in methods to interact with the users
- model() - returns the blueprint
- history( options ) - makes a history query
- events() - returns a
list
method to get all the events for the device
group methods
- get( id ) - gets the device
- list() - gets all the devices in the group
- create( device ) - creates a device in the group
- update( id, patchOps ) - updates the devices information
- delete( id ) - deletes the device
- obj( id ) - returns an instance of an
object
- model() - returns the blueprint