Update device info

PATCH/devices/{deviceId}

Base URL: https://api.tinkermode.com

Update the device with the specified ID. Normally, only the name and description fields of the device instance can be changed. But if the request is made with a Project API Key with "Admin" privileges, the device instance can be moved or added to a home by specifying a homeId field in the request body.

Authentication

Send an Authorization header of the form ModeCloud <AUTH_CODE>.

Must contain the key of a user or service account with permission to update the home device, or a project API key. To update the tag, homeId, or channel, the request must be made using the API the key of a user with permission to update project devices, or a project API key with "Admin" privileges. Also, to update the homeId with a user API key, the user must have both home devices delete permission on the current home and create home devices permission on the new home.

Path parameters

NameTypeRequiredConstraintsDescription
deviceIdintegerYesDevice ID

Request body

Content type: application/json

PropertyTypeRequiredConstraintsDescription
apiKeystringNoread-only (server-generated)API access key assigned to device. Usually hidden except to privileged clients, but is also present during the On-Demand Device Provisioning process.
bundleInstallTimestringNoread-only (server-generated); format: date-timeIf present, the timestamp when the firmware bundle was installed.
bundleInstalledstringNoread-only (server-generated)If present, the name of firmware bundle installed on this device.
channelstringNoread-only (server-generated)The name of firmware channel the device should download from.
claimCodestringNoClaim code assigned to device. Hidden except to privileged clients.
claimExpirationTimestringNoread-only (server-generated); format: date-timeExpiration time of device's claimable state.
claimTimestringNoread-only (server-generated); format: date-timeTimestamp of device being claimed by a user.
creationTimestringNoread-only (server-generated); format: date-timeTimestamp of device record creation.
descriptionstringNoDescription of device.
deviceClassstringYesread-only (server-generated)Device Class ID as defined by the project.
homeIdintegerNoThis property is present if device belongs to a home.
idintegerYesread-only (server-generated)Unique device ID.
isConnectedbooleanNoread-only (server-generated)Device is currently connected to MODE Cloud via a websocket or MQTT connection.
lastConnectTimestringNoread-only (server-generated); format: date-timeThe last time the device connected to the cloud.
lastDisconnectTimestringNoread-only (server-generated); format: date-timeThe last time the device disconnected from the cloud.
namestringNoDisplay name of device.
projectIdintegerYesread-only (server-generated)Project that this device belongs to.
tagstringNoAn optional/informational tag associated with device. Can be used to store the serial number, for example.

Request example

{
  "channel": "stable",
  "homeId": 1885,
  "name": "new_sensor_name",
  "tag": "new_001"
}

Responses

204 Successfully updated device properties. There is no return body.

401 Authorization is required to access this resource.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

403 Request failed because of invalid data or denied permission.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

404 The requested device does not exist or is not accessible.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

429 Request failed because of rate limit.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

500 An unexpected error has occurred.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

503 The service is temporarily unavailable.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.