Devices - Get Devices

Gets the identities of multiple devices from the IoT Hub identity registry. Not recommended. Use the IoT Hub query API to retrieve device twin and device identity information. See https://docs.microsoft.com/en-us/rest/api/iothub/service/queryiothub and https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-query-language for more information.

GET https://fully-qualified-iothubname.azure-devices.net/devices?api-version=2020-05-31-preview
GET https://fully-qualified-iothubname.azure-devices.net/devices?top={top}&api-version=2020-05-31-preview

URI Parameters

Name In Required Type Description
api-version
query True

string

Version of the Api.

top
query

integer

int32

The maximum number of device identities returned by the query. Any value outside the range of 1-1000 is considered to be 1000.

Responses

Name Type Description
200 OK

Device[]

OK.

Definitions

Name Description
AuthenticationMechanism
Device
DeviceCapabilities

The status of capabilities enabled on the device.

SymmetricKey
X509Thumbprint

AuthenticationMechanism

Name Type Description
symmetricKey

SymmetricKey

The primary and secondary keys used for SAS based authentication.

type enum:
  • certificateAuthority
  • none
  • sas
  • selfSigned

The type of authentication used to connect to the service.

x509Thumbprint

X509Thumbprint

The primary and secondary x509 thumbprints used for x509 based authentication.

Device

Name Type Description
authentication

AuthenticationMechanism

The authentication mechanism used by the device.

capabilities

DeviceCapabilities

The set of capabilities of the device. For example, if this device is an edge device or not.

cloudToDeviceMessageCount

integer

The number of cloud-to-device messages currently queued to be sent to the device.

connectionState enum:
  • Connected
  • Disconnected

The state of the device.

connectionStateUpdatedTime

string

The date and time the connection state was last updated.

deviceId

string

The unique identifier of the device.

deviceScope

string

The scope of the device. Auto generated and immutable for edge devices and modifiable in leaf devices to create child/parent relationship.

etag

string

The string representing a weak ETag for the device identity, as per RFC7232.

generationId

string

The IoT Hub-generated, case-sensitive string up to 128 characters long. This value is used to distinguish devices with the same deviceId, when they have been deleted and re-created.

lastActivityTime

string

The date and last time the device last connected, received, or sent a message.

status enum:
  • disabled
  • enabled

The status of the device. If the status disabled, a device cannot connect to the service.

statusReason

string

The 128 character-long string that stores the reason for the device identity status. All UTF-8 characters are allowed.

statusUpdatedTime

string

The date and time when the status field was last updated.

DeviceCapabilities

The status of capabilities enabled on the device.

Name Type Description
iotEdge

boolean

The property that determines if the device is an edge device or not.

SymmetricKey

Name Type Description
primaryKey

string

The base64 encoded primary key of the device.

secondaryKey

string

The base64 encoded secondary key of the device.

X509Thumbprint

Name Type Description
primaryThumbprint

string

The X509 client certificate primary thumbprint.

secondaryThumbprint

string

The X509 client certificate secondary thumbprint.