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

Bulk Registry - Update Registry

从IoT 中心标识注册表创建、更新或删除多个设备的标识。 在列表中只能指定一次设备标识。 允许在不同设备上 (创建、更新、删除) 的不同操作。 每个调用最多可以指定 100 个设备。 对于大规模操作,请使用 blob 存储 () https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities 的导入功能。

POST https://fully-qualified-iothubname.azure-devices.net/devices?api-version=2021-04-12

URI 参数

名称 必需 类型 说明
api-version
query True

string

Api 的版本。

请求正文

名称 类型 说明
devices

ExportImportDevice[]

要执行的注册表操作。

响应

名称 类型 说明
200 OK

BulkRegistryOperationResult

没问题。

400 Bad Request

BulkRegistryOperationResult

错误的请求。

定义

名称 说明
AuthenticationMechanism
BulkRegistryOperationResult

批量注册表操作的结果。

DeviceCapabilities

设备上启用的功能的状态。

DeviceRegistryOperationError

设备注册表操作错误详细信息。

DeviceRegistryOperationWarning

设备注册表操作警告详细信息。

ExportImportDevice
PropertyContainer

孪生体的所需属性和报告属性。 对象的最大深度为 10。

SymmetricKey
X509Thumbprint

AuthenticationMechanism

名称 类型 说明
symmetricKey

SymmetricKey

用于基于 SAS 的身份验证的主密钥和辅助密钥。

type enum:
  • certificateAuthority
  • none
  • sas
  • selfSigned

用于连接到服务的身份验证类型。

x509Thumbprint

X509Thumbprint

用于基于 x509 的身份验证的主要和辅助 x509 指纹。

BulkRegistryOperationResult

批量注册表操作的结果。

名称 类型 说明
errors

DeviceRegistryOperationError[]

设备注册表操作错误。

isSuccessful

boolean

操作结果。

warnings

DeviceRegistryOperationWarning[]

设备注册表操作警告。

DeviceCapabilities

设备上启用的功能的状态。

名称 类型 说明
iotEdge

boolean

确定设备是否为边缘设备的属性。

DeviceRegistryOperationError

设备注册表操作错误详细信息。

名称 类型 说明
deviceId

string

设备的唯一标识符。

errorCode enum:
  • AmqpAddressNotFound
  • ApplyConfigurationAlreadyInProgressOnDevice
  • ArgumentInvalid
  • ArgumentNull
  • AsyncOperationNotFound
  • AzureStorageTimeout
  • AzureTableStoreError
  • AzureTableStoreNotFound
  • BackupTimedOut
  • BlobContainerValidationError
  • BulkAddDevicesNotSupported
  • BulkRegistryOperationFailure
  • CallbackSubscriptionConflict
  • CannotModifyImmutableConfigurationContent
  • CannotRegisterModuleToModule
  • CertificateAuthorityConflict
  • CertificateAuthorityNotFound
  • CertificateNotFound
  • CheckpointStoreNotFound
  • ClientClosedRequest
  • ConfigReadFailed
  • ConfigurationAlreadyExists
  • ConfigurationCountLimitExceeded
  • ConfigurationNotAvailable
  • ConfigurationNotFound
  • ConnectionForcefullyClosed
  • ConnectionForcefullyClosedOnFaultInjection
  • ConnectionForcefullyClosedOnNewConnection
  • ConnectionRejectedOnFaultInjection
  • ConnectionUnavailable
  • CustomAllocationFailed
  • CustomAllocationIotHubNotSpecified
  • CustomAllocationUnauthorizedAccess
  • DefaultStorageEndpointNotConfigured
  • DeserializationError
  • DeviceAlreadyExists
  • DeviceConnectionClosedRemotely
  • DeviceDefinedMultipleTimes
  • DeviceDisabled
  • DeviceGroupConflict
  • DeviceGroupNotFound
  • DeviceInvalidResultCount
  • DeviceJobAlreadyExists
  • DeviceLocked
  • DeviceMaximumActiveFileUploadLimitExceeded
  • DeviceMaximumQueueDepthExceeded
  • DeviceMaximumQueueSizeExceeded
  • DeviceMessageLockLost
  • DeviceModelMaxIndexablePropertiesExceeded
  • DeviceModelMaxPropertiesExceeded
  • DeviceNotFound
  • DeviceNotOnline
  • DeviceRecordConflict
  • DeviceRecordNotFound
  • DeviceRegistrationNotFound
  • DeviceStorageEntitySerializationError
  • DeviceThrottlingLimitExceeded
  • DeviceUnavailable
  • DigitalTwinInterfaceNotFound
  • DigitalTwinModelAlreadyExists
  • DigitalTwinModelCountLimitExceeded
  • DigitalTwinModelExistsWithOtherModelType
  • DigitalTwinModelNotFound
  • DocumentDbInvalidReturnValue
  • ElasticPoolNotFound
  • ElasticPoolTenantHubNotFound
  • EnrollmentConflict
  • EnrollmentGroupConflict
  • EnrollmentGroupNotFound
  • EnrollmentNotFound
  • EtagDoesNotMatch
  • EventHubLinkAlreadyClosed
  • ExpiredFileUploadCorrelationId
  • FeatureNotSupported
  • GatewayTimeout
  • GenericBadGateway
  • GenericBadRequest
  • GenericConflict
  • GenericForbidden
  • GenericGatewayTimeout
  • GenericMethodNotAllowed
  • GenericNotFound
  • GenericPreconditionFailed
  • GenericRequestEntityTooLarge
  • GenericServerError
  • GenericServiceUnavailable
  • GenericTimeout
  • GenericTooManyRequests
  • GenericUnauthorized
  • GenericUnsupportedMediaType
  • GroupNotAvailable
  • GroupNotFound
  • GroupRecordConflict
  • GroupRecordNotFound
  • HostingServiceNotAvailable
  • ImportDevicesNotSupported
  • ImportWarningExistsError
  • IncompatibleDataType
  • InflightMessagesInLink
  • InterfaceNameCompressionModelCountLimitExceeded
  • InterfaceNameModelAlreadyExists
  • InterfaceNameModelNotFound
  • InvalidBlobState
  • InvalidConfigurationContent
  • InvalidConfigurationCustomMetricsQuery
  • InvalidConfigurationTargetCondition
  • InvalidContainerReceiveLink
  • InvalidContentEncodingOrType
  • InvalidDeviceScope
  • InvalidDigitalTwinJsonPatch
  • InvalidDigitalTwinPatch
  • InvalidDigitalTwinPatchPath
  • InvalidDigitalTwinPayload
  • InvalidEndorsementKey
  • InvalidEndpointAuthenticationType
  • InvalidEnrollmentGroupId
  • InvalidErrorCode
  • InvalidFileUploadCompletionStatus
  • InvalidFileUploadCorrelationId
  • InvalidMessageExpiryTime
  • InvalidMessagingEndpoint
  • InvalidOperation
  • InvalidPartitionEpoch
  • InvalidPnPDesiredProperties
  • InvalidPnPInterfaceDefinition
  • InvalidPnPReportedProperties
  • InvalidPnPWritableReportedProperties
  • InvalidProtocolVersion
  • InvalidRegistrationId
  • InvalidResponseWhileProxying
  • InvalidRouteTestInput
  • InvalidSchemaVersion
  • InvalidSourceOnRoute
  • InvalidStorageEndpoint
  • InvalidStorageEndpointOrBlob
  • InvalidStorageEndpointProperty
  • InvalidStorageRootKey
  • InvalidThrottleParameter
  • IotDpsSuspended
  • IotDpsSuspending
  • IotHubActivationFailed
  • IotHubFailingOver
  • IotHubFormatError
  • IotHubMaxCbsTokenExceeded
  • IotHubNotFound
  • IotHubQuotaExceeded
  • IotHubRestoring
  • IotHubSuspended
  • IotHubUnauthorized
  • IotHubUnauthorizedAccess
  • JobAlreadyExists
  • JobCancelled
  • JobNotFound
  • JobQuotaExceeded
  • JobRunPreconditionFailed
  • KeyEncryptionKeyRevoked
  • LinkCreationConflict
  • LinkedHubConflict
  • LinkedHubNotFound
  • ManagedIdentityNotEnabled
  • MessageTooLarge
  • ModelAlreadyExists
  • ModelRepoEndpointError
  • ModuleAlreadyExistsOnDevice
  • ModuleNotFound
  • NullMessage
  • OperationNotAllowedInCurrentState
  • OperationNotAvailableInCurrentTier
  • OrchestrationOperationFailed
  • OrphanDiscoveryDocument
  • PartitionNotFound
  • PreconditionFailed
  • ProvisioningRecordConflict
  • ProvisioningRecordNotFound
  • ProvisioningSettingsConflict
  • ProvisioningSettingsNotFound
  • QueryStoreClusterNotFound
  • QuotaMetricNotFound
  • ReceiveLinkOpensThrottled
  • RegistrationIdDefinedMultipleTimes
  • RegistrationStatusConflict
  • ReliableBlobStoreError
  • ReliableBlobStoreTimeoutError
  • ReliableDocDbStoreStoreError
  • RequestCanceled
  • RequestTimedOut
  • ResolutionError
  • RestoreTimedOut
  • RetryAttemptsExhausted
  • RoutingEndpointResponseForbidden
  • RoutingEndpointResponseNotFound
  • RoutingNotEnabled
  • SerializationError
  • ServerBusy
  • ServerError
  • ServiceUnavailable
  • StatisticsRetrievalError
  • StreamReservationFailure
  • SystemModuleModifyUnauthorizedAccess
  • SystemPropertyNotFound
  • TenantHubRoutingNotEnabled
  • ThrottleBacklogLimitExceeded
  • ThrottlingBacklogTimeout
  • ThrottlingException
  • ThrottlingMaxActiveJobCountExceeded
  • TooManyDevices
  • TooManyEnrollments
  • TooManyModulesOnDevice
  • UnableToCompressComponentInfo
  • UnableToCompressDiscoveryInfo
  • UnableToExpandComponentInfo
  • UnableToExpandDiscoveryInfo
  • UnableToFetchCredentials
  • UnableToFetchTenantInfo
  • UnableToShareIdentity
  • UnexpectedPropertyValue
  • UnsupportedOperationOnReplica

错误代码。

errorStatus

string

错误的详细信息。

moduleId

string

模块的唯一标识符(如果适用)。

operation

string

失败的操作的类型。

DeviceRegistryOperationWarning

设备注册表操作警告详细信息。

名称 类型 说明
deviceId

string

设备的唯一标识符。

warningCode enum:

DeviceRegisteredWithoutTwin

警告代码。

warningStatus

string

警告的详细信息。

ExportImportDevice

名称 类型 说明
authentication

AuthenticationMechanism

模块使用的身份验证机制。 此参数是可选的,如果未提供,则默认为 SAS。 在这种情况下,主/辅助访问密钥是自动生成的。

capabilities

DeviceCapabilities

设备上启用的功能的状态。

deviceScope

string

设备的范围。

eTag

string

表示设备RFC7232弱 ETag 的字符串。 仅当导入模式为 updateIfMatchETag 时才使用值,在这种情况下,仅当此 ETag 与服务器维护的值匹配时,才会执行导入操作。

id

string

设备的唯一标识符。

importMode enum:
  • create
  • delete
  • deleteIfMatchETag
  • update
  • updateIfMatchETag
  • updateTwin
  • updateTwinIfMatchETag

注册表操作和 ETag 首选项的类型。

moduleId

string

模块的唯一标识符(如果适用)。

parentScopes

string[]

上层边缘设备的范围(如果适用)。 仅适用于边缘设备。

properties

PropertyContainer

设备的所需属性和报告属性。

status enum:
  • disabled
  • enabled

模块的状态。 如果禁用,则模块无法连接到服务。

statusReason

string

存储设备标识状态原因的 128 字符长字符串。 允许所有 UTF-8 字符。

tags

object

由解决方案后端读取和写入的 JSON 文档。 这些标记对设备应用不可见。

twinETag

string

表示设备孪生RFC7232弱 ETag 的字符串。 仅当导入模式为 updateIfMatchETag 时才使用值,在这种情况下,仅当此 ETag 与服务器维护的值匹配时,才会执行导入操作。

PropertyContainer

孪生体的所需属性和报告属性。 对象的最大深度为 10。

名称 类型 说明
desired

object

所需属性键值对的集合。 密钥采用 UTF-8 编码,区分大小写,最大长度为 1KB。 允许的字符 (段 C0 和 C1) 、“.”、“$”和空间中排除 UNICODE 控制字符。 所需的 porperty 值是 JSON 对象,长度最大为 4KB。

reported

object

报告的属性键值对的集合。 密钥采用 UTF-8 编码,区分大小写,最大长度为 1KB。 允许的字符 (段 C0 和 C1) 、“.”、“$”和空间中排除 UNICODE 控制字符。 报告的属性值是 JSON 对象,长度最大为 4KB。

SymmetricKey

名称 类型 说明
primaryKey

string

设备的 base64 编码主键。

secondaryKey

string

设备的 base64 编码辅助密钥。

X509Thumbprint

名称 类型 说明
primaryThumbprint

string

X509 客户端证书主指纹。

secondaryThumbprint

string

X509 客户端证书辅助指纹。