In this article
Get All Devices
This endpoint returns a list of all devices.
URL
https://{{HOST}}/security/device?v={version}
Method
GET
Required IMS Scopes
- securityapi_all
Versions Supported
- 2.0 (Default)
URL Query Parameters
| Name | Description | Example | Type |
|---|---|---|---|
| v optional |
Version of the api to use | /device?v=2.0 | number |
Request Header Parameters
| Type | Value | Description |
|---|---|---|
| Authorization required |
Bearer {access_token} | IMS access token |
| Content-Type required |
application/json | Content Type |
Example
Request
curl -X GET
'https://{{HOST}}/securityapi/device?v=2.0'
-H 'authorization: Bearer {access_token}'
Response
{
"data": [
{
"properties": {
"DeviceID": "device3",
"HubEnabledState": null,
"CreatedTime": "2018-04-23T12:55:30.4561039Z",
"DeviceState": "normal",
"UpdatedTime": null
},
"commands": [],
"telemetries": null,
"shadow": {
"revision": 0,
"schemaVersion": 1,
"deviceType": 0
},
"id": "device3",
"subject": "835c47ec-8172-439a-a94a-90f747745837",
"organization": "jci.com"
},
{
"properties": {
"DeviceID": "device2",
"HubEnabledState": null,
"CreatedTime": "2018-04-30T15:27:24.9023518Z",
"DeviceState": "normal",
"UpdatedTime": null
},
"commands": [],
"telemetries": null,
"shadow": {
"revision": 0,
"schemaVersion": 1,
"deviceType": 0
},
"id": "device2",
"subject": "8c31d77b-0f0e-4a75-ae00-a8288b9cef3a",
"organization": "jci.com"
},
{
"properties": {
"DeviceID": "device1",
"HubEnabledState": null,
"CreatedTime": "2018-04-30T15:28:53.9799929Z",
"DeviceState": "normal",
"UpdatedTime": null
},
"commands": [],
"telemetries": null,
"shadow": {
"revision": 0,
"schemaVersion": 1,
"deviceType": 0
},
"id": "device1",
"subject": "ee0a0afa-0f23-4fbb-a9b1-98e40d9052a8",
"organization": "jci.com"
}
],
"paging": {
"totalCount": 3,
"continuationToken": "{"token":null,"range":{"min":"05C1B9CD673390","max":"05C1C9CD673390"}}"
}
}
Errors
| Error | Description |
|---|---|
| Error Name | Description of Error |
Response Body Parameters
| Name | Schema | Description |
|---|---|---|
| Id | String | Friendly identifier. Identifies the device name in IoT Hub. |
| PrimaryKey | Base64 String | Used to securely communicate to IoT Hub. If omitted on creation, the API generates one. |
| SecondaryKey | Base64 String | Used when changing the PrimaryKey, but is not needed for general communication. If omitted, the API generates one. |
| Properties | JSON Object | Used to store any metadata for the device. |
| Commands | JSON Array | Used to define supported commands for the device. |
| Telemetries | JSON Array | Used to show mapped telemetries for the device. |
| Status | JSON Object | Used to show the status for the device. |
Notes
continuationToken: You can use this token for paging. You can use the token provided in the Paging object of the previous response to get the next page. You can leave it blank to get the first page.