หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Modify a Device

Updated on 2024-12-02 GMT+08:00

Function

This API is used by an application to modify the basic information of a specific device on the IoT platform.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

PUT /v5/iot/{project_id}/devices/{device_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Parameter description: project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

device_id

Yes

String

Parameter description: device ID, which uniquely identifies a device. The value of this parameter is specified during device registration or allocated by the platform.

Value: The value can contain a maximum of 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

Parameter description: user token. You can obtain the token by calling the IAM API Obtaining a User Token Through Password Authentication. X-Subject-Token in the response header returned by the API is the desired user token. For details about how to obtain the token, see Token Authentication.

Instance-Id

No

String

Parameter description: instance ID. Unique identifier of each instance in the physical multi-tenant scenario. Mandatory for professional editions and recommended in other cases. Log in to the IoTDA console and choose Overview in the navigation pane to view the instance ID. For details, see Viewing Instance Details.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

device_name

No

String

** Parameter description**: device name, which uniquely identifies a device in a resource space.

Value: The value can contain a maximum of 256 characters. Only letters, digits, and special characters (_?'#().,&%@!-) are allowed. You are advised to use at least 4 characters.

description

No

String

Parameter description: device description.

Value: The value can contain a maximum of 2048 characters. Only letters, digits, and special characters (_?'#().,&%@!-) are allowed.

extension_info

No

Object

Parameter description: extended information, which can be customized. If child device details are modified, the modified details are not delivered to the gateway.

auth_info

No

AuthInfoWithoutSecret object

Parameter description: access authentication information about the device.

Table 4 AuthInfoWithoutSecret

Parameter

Mandatory

Type

Description

secure_access

No

Boolean

Parameter description: whether the device is connected to the platform using a secure protocol.

Options:

  • true: The device is connected to the platform using a secure protocol.

  • false: The device is connected to the platform using an insecure protocol. Devices connected to the platform using insecure protocols may be spoofed. You are advised not to use this value.

timeout

No

Integer

Parameter description: validity period for device access, in seconds. The default value is 0. If the device has not been connected to the IoT platform and activated within the validity period, the IoT platform deletes the registration information of the device. If this parameter is set to 0 (recommended), the platform does not delete the device registration information.

Note: This parameter takes effect only for directly connected devices.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

app_id

String

Resource space ID.

app_name

String

Resource space name.

device_id

String

Device ID, used to uniquely identify a device. The value of this parameter is specified during device registration or allocated by the platform. If the value is allocated by the platform, the value is in the format of [product_id]_[node_id].

node_id

String

Device identifier. This parameter is set to the IMEI, MAC address, or serial number.

gateway_id

String

Gateway ID, which is the device ID of the parent device. The gateway ID is the same as the device ID if the device is a directly connected device. If the device is an indirectly connected device, the gateway ID is the device ID of the directly connected device with which it associates.

device_name

String

Device name.

node_type

String

Device node type.

  • ENDPOINT: an indirectly connected device.

  • GATEWAY: a directly connected device or gateway.

  • UNKNOWN: The device node type is unknown.

description

String

Device description.

fw_version

String

Firmware version of the device.

sw_version

String

Software version of the device.

device_sdk_version

String

Device SDK information.

auth_info

AuthInfoRes object

Access authentication information about the device.

product_id

String

Unique ID of the product associated with the device.

product_name

String

Name of the product associated with the device.

status

String

Device status.

  • ONLINE: The device is online.

  • OFFLINE: The device is offline.

  • ABNORMAL: The device is abnormal.

  • INACTIVE: The device is not activated.

  • FROZEN: The device is frozen.

create_time

String

Time when the device was registered on the platform. The value is in the format of yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z.

connection_status_update_time

String

Time of the last device connection status change. Such statuses include ONLINE, OFFLINE, and ABNORMAL. The value is in the format of yyyy-MM-dd'T'HH:mm:ss.SSS'Z', for example, 2015-12-12T12:12:122Z.

active_time

String

Time when a device was activated. The value is in the format of yyyy-MM-dd'T'HH:mm:ss.SSS'Z', for example, 2015-12-12T12:12:122Z.

tags

Array of TagV5DTO objects

List of device tags.

extension_info

Object

Extended device information, which can be customized. If this parameter is specified for a child device during device creation, the platform will notify the gateway of the extended information using the MQTT API for notifying a gateway of new child device connection.

Table 6 AuthInfoRes

Parameter

Type

Description

auth_type

String

Parameter description: authentication type. If auth_type is not specified, the secret authentication is used.

Options:

  • SECRET: The secret authentication is used.

  • CERTIFICATES: The certificate authentication is used.

secret

String

Parameter description: device secret. This parameter is mandatory when auth_type is set to SECRET. Note: Due to protocol restrictions, NB-IoT device secrets must be hexadecimal values. This parameter is not returned when you query a device list.

Value: The value can contain 8 to 32 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

secondary_secret

String

** Parameter description**: secondary device secret used when the master secret fails to pass the authentication. This parameter is valid when auth_type is set to SECRET. Unavailable for devices accessed using CoAP. Note: Due to protocol restrictions, NB-IoT device secrets must be hexadecimal values. This parameter is not returned when you query a device list.

Value: The value can contain 8 to 32 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

fingerprint

String

Parameter description: certificate fingerprint. This parameter is valid when auth_type is set to CERTIFICATES. If this parameter is not specified during device registration, the certificate fingerprint used during the first device access is used.

Value: The value is a string of 40 or 64 hexadecimal characters.

secondary_fingerprint

String

** Parameter description**: secondary certificate fingerprint used when the master fingerprint fails to pass the authentication. This parameter is valid when auth_type is set to CERTIFICATES.

Value: The value is a string of 40 or 64 hexadecimal characters.

secure_access

Boolean

Parameter description: whether the device is connected to the platform using a secure protocol.

Options:

  • true: The device is connected to the platform using a secure protocol.

  • false: The device is connected to the platform using an insecure protocol. Devices connected to the platform using insecure protocols may be spoofed. You are advised not to use this value.

timeout

Integer

Parameter description: validity period for device access, in seconds. The default value is 0.

If the device has not been connected to the IoT platform and activated within the validity period, the IoT platform deletes the registration information of the device. If this parameter is set to 0 (recommended), the platform does not delete the device registration information.

Note: This parameter is only available for directly connected devices.

Table 7 TagV5DTO

Parameter

Type

Description

tag_key

String

Parameter description: tag key, which is unique for a resource. If the specified key already exists, the value of the existing tag is overwritten. If the specified key does not exist, a new tag is added.

Value: The value can contain a maximum of 64 characters. Only letters, digits, underscores (_), periods (.), and hyphens (-) are allowed.

tag_value

String

Parameter description: tag value.

Value: The value can contain a maximum of 128 characters. Only letters, digits, underscores (_), periods (.), and hyphens (-) are allowed.

Example Requests

Changes the device name to device and access type to secure access.

PUT https://{endpoint}/v5/iot/{project_id}/devices/{device_id}

{
  "device_name" : "device",
  "description" : "watermeter device",
  "extension_info" : {
    "aaa" : "xxx",
    "bbb" : 0
  },
  "auth_info" : {
    "secure_access" : true
  }
}

Example Responses

Status code: 200

OK

{
  "app_id" : "jeQDJQZltU8iKgFFoW060F5SGZka",
  "app_name" : "testAPP01",
  "device_id" : "d4922d8a-6c8e-4396-852c-164aefa6638f",
  "node_id" : "ABC123456789",
  "gateway_id" : "d4922d8a-6c8e-4396-852c-164aefa6638f",
  "device_name" : "dianadevice",
  "node_type" : "ENDPOINT",
  "description" : "watermeter device",
  "fw_version" : "1.1.0",
  "sw_version" : "1.1.0",
  "auth_info" : {
    "auth_type" : "SECRET",
    "secret" : "3b935a250c50dc2c6d481d048cefdc3c",
    "fingerprint" : "dc0f1016f495157344ac5f1296335cff725ef22f",
    "secure_access" : true,
    "timeout" : 0
  },
  "product_id" : "b640f4c203b7910fc3cbd446ed437cbd",
  "product_name" : "Thermometer",
  "status" : "ONLINE",
  "create_time" : "20190303T081011Z",
  "connection_status_update_time" : "2019-03-03T08:10:111Z",
  "active_time" : "2019-03-03T08:10:111Z",
  "tags" : [ {
    "tag_key" : "testTagName",
    "tag_value" : "testTagValue"
  } ],
  "extension_info" : {
    "aaa" : "xxx",
    "bbb" : 0
  }
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback