In this article
Get Device For Another User
Get Device for Another User
To get a device on behalf of another user, you must pass the following parameters:
- an existing User ID.
- an existing Device ID.
If the user is linked to the device, you receive a success response and the device object. If the user is not linked to the device, you receive a response indicating that the device cannot be found for the user.
URL
https://{{HOST}}/security/device/?v={version}&deviceId={deviceId}&userId={userId}
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 |
| deviceId required |
The ID of the device. | /device?deviceId=testDevice | string |
| userId required |
The ID of the user. | /device?userId=testUser | string |
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&deviceId=testDevie&userId=testUser'
-H 'Authorization: Bearer {access_token}'
Response
{
"success": "true",
"result": {
"properties": {
"DeviceID": "testDevice",
"HubEnabledState": null,
"CreatedTime": "2017-02-22T15:30:21.7787616Z",
"DeviceState": "normal",
"UpdatedTime": null
},
"commands": [],
"telemetries": null,
"shadow": {
"revision": 0,
"schemaVersion": 1,
"deviceType": 0
},
"id": "testDevice",
"subject": null
}
}
Errors
| Error | Description |
|---|---|
| Error Name | Description of Error |
Response Body Parameters
| Name | Description | Schema |
|---|---|---|
| Object Name | Description | object definition |
| success | Description | object definition |
| result | Description | object definition |