Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

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 Product

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

Function

This API is used by an application to modify details of a product model that has been imported to the IoT platform, including the services, properties, and commands in the product model. This API is used to modify the product but not to modify or install a codec. If the service definition in the product is modified and the corresponding codec exists on the platform, modify and reinstall the codec.

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}/products/{product_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.

product_id

Yes

String

Parameter description: product ID, which uniquely identifies a product. It is allocated by the platform after the product is created on the platform.

Value: The value can contain a maximum of 36 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

app_id

No

String

Parameter description: resource space ID. This parameter is optional. If you have multiple resource spaces, you can use this parameter to specify the resource space that the product to be modified belongs to. If this parameter is not specified, the product in the default resource space will be modified. If there is no product in the default resource space, the earliest created product will be modified. If you have multiple resource spaces and do not want to specify this parameter, contact Huawei technical engineers to combine your resource spaces.

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

name

No

String

Parameter description: product name.

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

device_type

No

String

Parameter description: device type.

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

protocol_type

No

String

Parameter description: protocol used by the device. Do not change other protocol types to CoAP.

Options: MQTT, CoAP, HTTP, HTTPS, Modbus, ONVIF, OPC-UA, OPC-DA, TCP, ""UDP**, and Other.

data_format

No

String

Parameter description: format of the data reported by the device.

Options:

  • json: JSON format

  • binary: binary code stream format

service_capabilities

No

Array of ServiceCapability objects

Parameter description: list of service capabilities of the device.

manufacturer_name

No

String

Parameter description: manufacturer name.

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

industry

No

String

Parameter description: industry to which the device belongs.

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

description

No

String

Parameter description: product description.

Value: The value can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_?'#().,;&%@!-:$![]~/) are allowed.

Table 4 ServiceCapability

Parameter

Mandatory

Type

Description

service_id

Yes

String

Parameter description: service ID of the device. The value must be unique in a product.

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

service_type

Yes

String

Parameter description: service type of the device.

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

properties

No

Array of ServiceProperty objects

Parameter description: list of properties supported by the device service.

Value: The array length cannot exceed 500.

commands

No

Array of ServiceCommand objects

Parameter description: list of commands supported by the device service.

Value: The array length cannot exceed 500.

events

No

Array of ServiceEvent objects

Parameter description: list of events supported by the device service. Currently, event customization is not supported. You do not need to define this field when creating or modifying a product.

Value: The array length cannot exceed 500.

description

No

String

Parameter description: device service description.

Value: The value can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_?'#().,;&%@!-:$![]~/) are allowed.

option

No

String

Parameter description: whether the device service is mandatory. Currently, this field is not a functional field and is used only for identification.

Options:

  • Master: master service

  • Mandatory: mandatory service

  • Optional: optional service

    The default value is Optional.

Table 5 ServiceProperty

Parameter

Mandatory

Type

Description

property_name

Yes

String

Parameter description: device property name. The value must be unique in the device service. If device property names are used as keys in the device shadow JSON file, the names cannot contain periods (.), dollar signs ($), and the null character (hexadecimal ASCII code 00). A device shadow file that contains these special characters cannot be updated.

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

data_type

Yes

String

Parameter description: data type of the device property.

Options: int, long, decimal, string, DateTime, jsonObject, enum, boolean, and string list.

required

No

Boolean

Parameter description: whether the device property is mandatory. The default value is false.

enum_list

No

Array of strings

Parameter description: list of enumerated values of the device property.

min

No

String

Parameter description: minimum value of the device property.

Value length: 1–16 characters

max

No

String

Parameter description: maximum value of the device property.

Value length: 1–16 characters

max_length

No

Integer

Parameter description: maximum length of the device property.

step

No

Double

Parameter description: step of the device property.

unit

No

String

Parameter description: unit of the device property.

Value length: a maximum of 16 characters

method

Yes

String

Parameter description: access mode of the device property.

Options: RWE, RW, RE, WE, E, W, and R.

  • R: The property value can be read.

  • W: The property value can be written.

  • E: The property value can be subscribed to, that is, an event is reported when the property value changes.

description

No

String

Parameter description: device property description.

Value: The value can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_?'#().,;&%@!-:$![]~/) are allowed.

default_value

No

Object

Parameter description: default value of the device property. If the default value is set, it will be written to the desired data of the device shadow when the product is used to create a device. When the device goes online, the default value will be delivered to the device.

Table 6 ServiceCommand

Parameter

Mandatory

Type

Description

command_name

Yes

String

Parameter description: device command name. The value must be unique in the device service.

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

paras

No

Array of ServiceCommandPara objects

Parameter description: list of device command parameters.

responses

No

Array of ServiceCommandResponse objects

Parameter description: list of response parameters of the device command.

Table 7 ServiceCommandResponse

Parameter

Mandatory

Type

Description

response_name

Yes

String

Parameter description: name of the device command response.

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

paras

No

Array of ServiceCommandPara objects

Parameter description: list of response parameters of the device command.

Table 8 ServiceEvent

Parameter

Mandatory

Type

Description

event_type

Yes

String

Parameter description: device event type. The value must be unique in the device service.

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

paras

No

Array of ServiceCommandPara objects

Parameter description: list of device event parameters.

Table 9 ServiceCommandPara

Parameter

Mandatory

Type

Description

para_name

Yes

String

Parameter description: parameter name.

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

data_type

Yes

String

Parameter description: data type of the parameter.

Options: int, long, decimal, string, DateTime, jsonObject, enum, boolean, and string list.

required

No

Boolean

Parameter description: whether the parameter is mandatory. The default value is false.

enum_list

No

Array of strings

Parameter description: list of enumerated values of the parameter.

min

No

String

Parameter description: minimum value of the parameter.

Value length: 1–16 characters

max

No

String

Parameter description: maximum value of the parameter.

Value length: 1–16 characters

max_length

No

Integer

Parameter description: maximum length of the parameter.

step

No

Double

Parameter description: step of the parameter.

unit

No

String

Parameter description: unit of the parameter.

Value length: a maximum of 16 characters

description

No

String

Parameter description: parameter description.

Value: The value can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_?'#().,;&%@!-:$![]~/) are allowed.

Response Parameters

Status code: 200

Table 10 Response body parameters

Parameter

Type

Description

app_id

String

Resource space ID.

app_name

String

Resource space name.

product_id

String

Product ID, which uniquely identifies a product. It is allocated by the platform after the product is created on the platform.

name

String

Product name.

device_type

String

Device type.

protocol_type

String

Protocol used by a device. Options: MQTT, CoAP, HTTP, HTTPS, Modbus, ONVIF, OPC-UA, OPC-DA, TCP, ""UDP**, and Other.

data_format

String

Format of the data reported by the device. Options: json and binary.

manufacturer_name

String

Manufacturer name.

industry

String

Industry to which the device belongs.

description

String

Product description.

service_capabilities

Array of ServiceCapability objects

List of service capabilities of the device.

create_time

String

Time when a product was created on the platform. The format is yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z.

Table 11 ServiceCapability

Parameter

Type

Description

service_id

String

Parameter description: service ID of the device. The value must be unique in a product.

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

service_type

String

Parameter description: service type of the device.

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

properties

Array of ServiceProperty objects

Parameter description: list of properties supported by the device service.

Value: The array length cannot exceed 500.

commands

Array of ServiceCommand objects

Parameter description: list of commands supported by the device service.

Value: The array length cannot exceed 500.

events

Array of ServiceEvent objects

Parameter description: list of events supported by the device service. Currently, event customization is not supported. You do not need to define this field when creating or modifying a product.

Value: The array length cannot exceed 500.

description

String

Parameter description: device service description.

Value: The value can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_?'#().,;&%@!-:$![]~/) are allowed.

option

String

Parameter description: whether the device service is mandatory. Currently, this field is not a functional field and is used only for identification.

Options:

  • Master: master service

  • Mandatory: mandatory service

  • Optional: optional service

    The default value is Optional.

Table 12 ServiceProperty

Parameter

Type

Description

property_name

String

Parameter description: device property name. The value must be unique in the device service. If device property names are used as keys in the device shadow JSON file, the names cannot contain periods (.), dollar signs ($), and the null character (hexadecimal ASCII code 00). A device shadow file that contains these special characters cannot be updated.

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

data_type

String

Parameter description: data type of the device property.

Options: int, long, decimal, string, DateTime, jsonObject, enum, boolean, and string list.

required

Boolean

Parameter description: whether the device property is mandatory. The default value is false.

enum_list

Array of strings

Parameter description: list of enumerated values of the device property.

min

String

Parameter description: minimum value of the device property.

Value length: 1–16 characters

max

String

Parameter description: maximum value of the device property.

Value length: 1–16 characters

max_length

Integer

Parameter description: maximum length of the device property.

step

Double

Parameter description: step of the device property.

unit

String

Parameter description: unit of the device property.

Value length: a maximum of 16 characters

method

String

Parameter description: access mode of the device property.

Options: RWE, RW, RE, WE, E, W, and R.

  • R: The property value can be read.

  • W: The property value can be written.

  • E: The property value can be subscribed to, that is, an event is reported when the property value changes.

description

String

Parameter description: device property description.

Value: The value can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_?'#().,;&%@!-:$![]~/) are allowed.

default_value

Object

Parameter description: default value of the device property. If the default value is set, it will be written to the desired data of the device shadow when the product is used to create a device. When the device goes online, the default value will be delivered to the device.

Table 13 ServiceCommand

Parameter

Type

Description

command_name

String

Parameter description: device command name. The value must be unique in the device service.

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

paras

Array of ServiceCommandPara objects

Parameter description: list of device command parameters.

responses

Array of ServiceCommandResponse objects

Parameter description: list of response parameters of the device command.

Table 14 ServiceCommandResponse

Parameter

Type

Description

response_name

String

Parameter description: name of the device command response.

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

paras

Array of ServiceCommandPara objects

Parameter description: list of response parameters of the device command.

Table 15 ServiceEvent

Parameter

Type

Description

event_type

String

Parameter description: device event type. The value must be unique in the device service.

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

paras

Array of ServiceCommandPara objects

Parameter description: list of device event parameters.

Table 16 ServiceCommandPara

Parameter

Type

Description

para_name

String

Parameter description: parameter name.

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

data_type

String

Parameter description: data type of the parameter.

Options: int, long, decimal, string, DateTime, jsonObject, enum, boolean, and string list.

required

Boolean

Parameter description: whether the parameter is mandatory. The default value is false.

enum_list

Array of strings

Parameter description: list of enumerated values of the parameter.

min

String

Parameter description: minimum value of the parameter.

Value length: 1–16 characters

max

String

Parameter description: maximum value of the parameter.

Value length: 1–16 characters

max_length

Integer

Parameter description: maximum length of the parameter.

step

Double

Parameter description: step of the parameter.

unit

String

Parameter description: unit of the parameter.

Value length: a maximum of 16 characters

description

String

Parameter description: parameter description.

Value: The value can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_?'#().,;&%@!-:$![]~/) are allowed.

Example Requests

Changes the product name to Thermometer and service to temperature.

PUT https://{endpoint}/v5/iot/{project_id}/products/{product_id}

{
  "app_id" : "jeQDJQZltU8iKgFFoW060F5SGZka",
  "name" : "Thermometer.",
  "device_type" : "Thermometer",
  "protocol_type" : "MQTT",
  "data_format" : "json",
  "service_capabilities" : [ {
    "service_id" : "Temperature.",
    "service_type" : "temperature",
    "properties" : [ {
      "property_name" : "temperature",
      "data_type" : "decimal",
      "required" : true,
      "enum_list" : null,
      "min" : "1",
      "max" : "100",
      "max_length" : 100,
      "step" : 0.1,
      "unit" : "centigrade",
      "method" : "RW",
      "description" : "force",
      "default_value" : {
        "color" : "red",
        "size" : 1
      }
    } ],
    "commands" : [ {
      "command_name" : "reboot",
      "paras" : [ {
        "para_name" : "force",
        "data_type" : "string",
        "required" : false,
        "enum_list" : null,
        "min" : "1",
        "max" : "100",
        "max_length" : 100,
        "step" : 0.1,
        "unit" : "km/h",
        "description" : "force"
      } ],
      "responses" : [ {
        "response_name" : "ACK",
        "paras" : [ {
          "para_name" : "force",
          "data_type" : "string",
          "required" : false,
          "enum_list" : null,
          "min" : "1",
          "max" : "100",
          "max_length" : 100,
          "step" : 0.1,
          "unit" : "km/h",
          "description" : "force"
        } ]
      } ]
    } ],
    "events" : [ {
      "event_type" : "reboot",
      "paras" : [ {
        "para_name" : "force",
        "data_type" : "string",
        "required" : false,
        "enum_list" : null,
        "min" : "1",
        "max" : "100",
        "max_length" : 100,
        "step" : 0.1,
        "unit" : "km/h",
        "description" : "force"
      } ]
    } ],
    "description" : "temperature",
    "option" : "Mandatory"
  } ],
  "manufacturer_name" : "ABC",
  "industry" : "smartCity",
  "description" : "this is a thermometer produced by Huawei"
}

Example Responses

Status code: 200

Successful response

{
  "app_id" : "jeQDJQZltU8iKgFFoW060F5SGZka",
  "app_name" : "testAPP01",
  "product_id" : "5ba24f5ebbe8f56f5a14f605",
  "name" : "Thermometer",
  "device_type" : "Thermometer",
  "protocol_type" : "MQTT",
  "data_format" : "json",
  "manufacturer_name" : "ABC",
  "industry" : "smartCity",
  "description" : "this is a thermometer produced by Huawei",
  "service_capabilities" : [ {
    "service_id" : "temperature",
    "service_type" : "temperature",
    "properties" : [ {
      "property_name" : "temperature",
      "required" : true,
      "data_type" : "decimal",
      "enum_list" : null,
      "min" : "1",
      "max" : "100",
      "max_length" : 100,
      "step" : 0.1,
      "unit" : "centigrade",
      "method" : "RW",
      "description" : "force",
      "default_value" : {
        "color" : "red",
        "size" : 1
      }
    } ],
    "commands" : [ {
      "command_name" : "reboot",
      "paras" : [ {
        "para_name" : "force",
        "required" : false,
        "data_type" : "string",
        "enum_list" : null,
        "min" : "1",
        "max" : "100",
        "max_length" : 100,
        "step" : 0.1,
        "unit" : "km/h",
        "description" : "force"
      } ],
      "responses" : [ {
        "response_name" : "ACK",
        "paras" : [ {
          "para_name" : "force",
          "required" : false,
          "data_type" : "string",
          "enum_list" : null,
          "min" : "1",
          "max" : "100",
          "max_length" : 100,
          "step" : 0.1,
          "unit" : "km/h",
          "description" : "force"
        } ]
      } ]
    } ],
    "events" : [ {
      "event_type" : "reboot",
      "paras" : [ {
        "para_name" : "force",
        "required" : false,
        "data_type" : "string",
        "enum_list" : null,
        "min" : "1",
        "max" : "100",
        "max_length" : 100,
        "step" : 0.1,
        "unit" : "km/h",
        "description" : "force"
      } ]
    } ],
    "description" : "temperature",
    "option" : "Mandatory"
  } ],
  "create_time" : "20190303T081011Z"
}

Status Codes

Status Code

Description

200

Successful response

400

Bad Request

401

Unauthorized

403

FORBIDDEN

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback