Upgrade device configuration
1. Access your devices
To access your devices, you need to make a request to the Emerit API. You can use the following query to fetch the list of devices associated with your account:
query QUERY_ALL_DEVICES {
getAllDevices {
devices {
id
uniqueIdNumber
isFree
deviceConfigs {
id
}
site {
name
}
}
}
}
The id of the device is needed to follow the next steps.
2. Get the current configuration of the device
To get the current configuration of the device, you need to make a request to the Emerit API. You can use the following query to fetch the configuration of a device:
You can use the id
field to identify the device you want to update.
query QUERY_LAST_DEVICE_CONFIG_BY_DEVICE_ID($deviceId: String!) {
getLastDeviceConfigByDeviceId(deviceId: $deviceId) {
id
version
hasBeenAppliedByDeviceAt
config
createdAt
updatedAt
}
}
The configuration of the device is stored in the config
field. You can use this field to update the configuration of the device.
3. Update the configuration of the device
To update the configuration of the device, you need to make a request to the Emerit API. You can use the following mutation to update the configuration of a device:
You can use the id
field to identify the device you want to update.
mutation UPGRADE_DEVICE_CONFIG(
$input: DeviceConfigInput!
) {
upgradeDeviceConfig(input: $input) {
result
errors {
message
propertyPath
value
}
deviceConfig {
version
}
}
}
Here the input
field is an object that contains the following fields:
deviceId
: The id of the device you want to update.config
: The new configuration you want to apply to the device.
Don't forget that you can find all the types and fields in the API documentation. Look at the sidebar for more information.