你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Device Management - Get Device

获取连接到 IoT 中心设备更新的设备的设备属性和最新部署状态。

GET https://{endpoint}/deviceUpdate/{instanceId}/management/devices/{deviceId}?api-version=2022-10-01

URI 参数

名称 必需 类型 说明
deviceId
path True

string

Azure IoT 中心中的设备标识符。

endpoint
path True

string (url)

IoT 中心帐户终结点的设备更新(仅主机名,无协议)。

instanceId
path True

string

IoT 中心帐户实例标识符的设备更新。

api-version
query True

string

要用于客户端请求的 API 的版本。

响应

名称 类型 说明
200 OK

Device

设备属性和最新部署状态。

Other Status Codes

ErrorResponse

默认响应。

安全性

azure_auth

Azure Active Directory OAuth2 流

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
https://api.adu.microsoft.com/.default 默认授权范围。

示例

DeviceManagement_GetDevice

示例请求

GET https://contoso.api.adu.microsoft.com/deviceUpdate/blue/management/devices/deviceId?api-version=2022-10-01

示例响应

{
  "deviceId": "device1",
  "deviceClassId": "deviceClass1",
  "lastAttemptedUpdate": {
    "updateId": {
      "provider": "provider1",
      "name": "name1",
      "version": "2.0.0.0"
    },
    "description": "Fixes performance issue."
  },
  "deploymentStatus": "Failed",
  "installedUpdate": {
    "updateId": {
      "provider": "provider1",
      "name": "name1",
      "version": "1.0.0.0"
    },
    "description": "Fixes security issue."
  },
  "onLatestUpdate": false,
  "lastInstallResult": {
    "resultCode": 200,
    "extendedResultCode": 0,
    "resultDetails": "",
    "stepResults": [
      {
        "update": {
          "updateId": {
            "provider": "microsoft",
            "name": "peripheralcamera",
            "version": "1.0"
          },
          "friendlyName": "Microsoft Peripheral Camera 1.0"
        },
        "resultCode": 200,
        "extendedResultCode": 0,
        "resultDetails": ""
      },
      {
        "update": {
          "updateId": {
            "provider": "microsoft",
            "name": "peripheralspeaker",
            "version": "1.0"
          },
          "friendlyName": "Microsoft Peripheral Speaker 1.0"
        },
        "resultCode": 200,
        "extendedResultCode": 0,
        "resultDetails": ""
      }
    ]
  }
}

定义

名称 说明
Device

设备元数据。

DeviceDeploymentState

部署状态。

Error

错误详细信息。

ErrorResponse

常见的错误响应。

InnerError

包含与当前对象有关错误的更具体信息的对象。

InstallResult

更新的安装结果及其下的任何步骤结果。

StepResult

更新下的步骤结果。

UpdateId

更新标识符。

UpdateInfo

更新信息。

Device

设备元数据。

名称 类型 说明
deploymentStatus

DeviceDeploymentState

设备在上次部署中的状态。

deviceClassId

string

设备类标识。

deviceId

string

设备标识。

groupId

string

设备组标识。

installedUpdate

UpdateInfo

当前在设备上安装了更新。

lastAttemptedUpdate

UpdateInfo

设备上次尝试安装的更新。

lastDeploymentId

string

上次部署到设备的部署标识符

lastInstallResult

InstallResult

上次安装结果。

moduleId

string

设备模块标识。

onLatestUpdate

boolean

指示设备上是否安装了最新更新(设备设备类和组的最佳兼容更新)的布尔标志

DeviceDeploymentState

部署状态。

说明
Succeeded

部署已成功完成。

InProgress

部署正在进行中。

Canceled

部署已取消。

Failed

部署已完成,但失败。

Error

错误详细信息。

名称 类型 说明
code

string

服务器定义的错误代码。

details

Error[]

导致报告错误的错误的数组。

innererror

InnerError

包含与当前对象有关错误的更具体信息的对象。

message

string

错误的人工可读表示形式。

occurredDateTime

string (date-time)

发生错误的日期和时间(UTC)。

target

string

错误的目标。

ErrorResponse

常见的错误响应。

名称 类型 说明
error

Error

错误详细信息。

InnerError

包含与当前对象有关错误的更具体信息的对象。

名称 类型 说明
code

string

比包含的错误提供的错误代码更具体。

errorDetail

string

内部错误或异常消息。

innerError

InnerError

包含与当前对象有关错误的更具体信息的对象。

message

string

错误的人工可读表示形式。

InstallResult

更新的安装结果及其下的任何步骤结果。

名称 类型 说明
extendedResultCode

integer

安装扩展的结果代码

resultCode

integer

安装结果代码。

resultDetails

string

包含有关安装结果的更多详细信息的字符串

stepResults

StepResult[]

步骤结果数组

StepResult

更新下的步骤结果。

名称 类型 说明
description

string

步骤说明。

extendedResultCode

integer

安装扩展的结果代码

resultCode

integer

安装结果代码。

resultDetails

string

包含有关安装结果的更多详细信息的字符串

update

UpdateInfo

此步骤安装的更新(如果它为引用类型)。

UpdateId

更新标识符。

名称 类型 说明
name

string

更新名称。

provider

string

更新提供程序。

version

string

更新版本。

UpdateInfo

更新信息。

名称 类型 说明
description

string

更新说明。

friendlyName

string

友好更新名称。

updateId

UpdateId

更新标识符。