Get all devices

GET/devices

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

Get the list of devices of a project (by using the projectId parameter), or devices belonging to a home (by using the homeId parameter). Either project ID or home ID must be specified. To fetch the devices of a project, the request must be made using the API the key of a user with permission to read all devices, or a project API key. An optional deviceClass parameter can be used to return only devices of the specified device class. An optional tag parameter can be used to return only devices with the specified tag. An optional hasHome parameter can be used to filter devices based on whether they belong to a home or not.

Authentication

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

Must contain the key of a user or service account who has access to devices or project API key.

Query parameters

NameTypeRequiredConstraintsDescription
deviceClassstringNoReturn devices of the specified Device Class ID.
hasHomebooleanNoFilter devices based on home assignment. If true, return only devices that belong to a home. If false, return only devices that do not belong to a home.
homeIdintegerNoReturn devices that belong to the specified home.
limitintegerNodefault: 25; min: 1Maximum number of devices to return.
projectIdintegerNoReturn devices of the specified project.
searchstringNoSearch for devices by keywords.
skipintegerNodefault: 0; min: 0Number of devices to skip over.
tagstringNoReturn devices with the specified tag. Case-insensitive substring match is performed. If tag and search are both specified, devices that match tag OR search are returned.

Responses

200 Successful retrieval of all devices.

Content type: application/json

Represents a device instance created by a project.

An array of objects with the following shape:

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.

Response example

[
  {
    "claimExpirationTime": "2019-09-18T22:19:39Z",
    "claimTime": "2019-09-18T22:19:39Z",
    "deviceClass": "smart_sensor",
    "homeId": 1701,
    "id": 34256,
    "isConnected": false,
    "lastConnectTime": "2019-09-18T22:31:20.678Z",
    "lastDisconnectTime": "2019-09-18T22:34:19.314Z",
    "name": "happy",
    "projectId": 1265,
    "tag": "store_one"
  },
  {
    "claimExpirationTime": "2019-09-18T23:42:39.885Z",
    "deviceClass": "smart_sensor",
    "id": "343d8",
    "isConnected": false,
    "name": "sad",
    "projectId": 1265,
    "tag": "store_one"
  }
]

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 denied permission.

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.