title | description | author | ms.localizationpriority | ms.subservice | doc_type |
---|---|---|---|---|---|
Get device |
Get the properties and relationships of a device object. |
sandeo-MSFT |
medium |
entra-directory-management |
apiPageType |
Namespace: microsoft.graph
Get the properties and relationships of a device object.
[!INCLUDE national-cloud-support]
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
[!INCLUDE permissions-table]
You can address the device using either its id or deviceId.
GET /devices/{id}
GET /devices(deviceId='{deviceId}')
This method supports the $select
OData query parameter to help customize the response.
Name | Type | Description |
---|---|---|
Authorization | string | Bearer {token}. Required. |
Don't supply a request body for this method.
If successful, this method returns a 200 OK
response code and device object in the response body.
The following example shows a request.
GET https://graph.microsoft.com/v1.0/devices/000005c3-b7a6-4c61-89fc-80bf5ccfc366
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#devices/$entity",
"@odata.id": "https://graph.microsoft.com/v2/72f988bf-86f1-41af-91ab-2d7cd011db47/directoryObjects/000005c3-b7a6-4c61-89fc-80bf5ccfc366/Microsoft.DirectoryServices.Device",
"accountEnabled":false,
"deviceId":"6fa60d52-01e7-4b18-8055-4759461fc16b",
"displayName":"DESKTOP-858MANH",
"id": "000005c3-b7a6-4c61-89fc-80bf5ccfc366",
"operatingSystem":"Windows",
"operatingSystemVersion":"10.0.19043.1165"
}
The following request retrieves the id and extensionAttributes property of a device.
GET https://graph.microsoft.com/beta/devices/6a59ea83-02bd-468f-a40b-f2c3d1821983?$select=id,extensionAttributes
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#devices(id,extensionAttributes)/$entity",
"id": "6a59ea83-02bd-468f-a40b-f2c3d1821983",
"extensionAttributes": {
"extensionAttribute1": "BYOD-Device",
"extensionAttribute2": null,
"extensionAttribute3": null,
"extensionAttribute4": null,
"extensionAttribute5": null,
"extensionAttribute6": null,
"extensionAttribute7": null,
"extensionAttribute8": null,
"extensionAttribute9": null,
"extensionAttribute10": null,
"extensionAttribute11": null,
"extensionAttribute12": null,
"extensionAttribute13": null,
"extensionAttribute14": null,
"extensionAttribute15": null
}
}