Device - Get Devices And Modules In Scope

Query IotHub to retrieve information regarding devices which belong to the same deviceScope. See https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language for more information. Pagination of results is supported. This returns information about device twins only.

GET https://fully-qualified-iothubname.azure-devices.net/devices/{deviceId}/modules/{moduleId}/devicesAndModulesInDeviceScope?api-version=2020-03-13

URI Parameters

Name In Required Type Description
deviceId
path True

string

moduleId
path True

string

api-version
query True

string

Version of the Api.

Responses

Name Type Description
200 OK

ScopeResult

Get devices in scope with continuation token if appropriate.

Definitions

Name Description
AuthenticationMechanism
Device
DeviceCapabilities

The status of capabilities enabled on the device.

Module

The module identity on a device.

ScopeResult

The query result.

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.

Module

The module identity on a device.

Name Type Description
authentication

AuthenticationMechanism

The authentication mechanism used by the module when connecting to the service and edge hub.

cloudToDeviceMessageCount

integer

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

connectionState enum:
  • Connected
  • Disconnected

The connection state of the device.

connectionStateUpdatedTime

string

The date and time the connection state was last updated.

deviceId

string

The unique identifier of the device.

etag

string

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

generationId

string

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

lastActivityTime

string

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

managedBy

string

Identifies who manages this module. For instance, this value is "IotEdge" if the edge runtime owns this module.

moduleId

string

The unique identifier of the module.

ScopeResult

The query result.

Name Type Description
continuationLink

string

Request continuation token.

devices

Device[]

The scope result items, as a collection.

modules

Module[]

The scope result items, as a collection.

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.