History
Introduction
API Category
Making API Requests
Region APIs
Instance APIs
Cloud Hosting Cluster APIs
Image APIs
Instance Launch Template APIs
Placement Group APIs
Key APIs
Security Group APIs
Network APIs
Data Types
Error Codes
Service URL/v3/device/set_custom_attribute
Parameter | Required | Type | Description |
cmd | Yes | Integer | Operation type: 1: adding an attribute. 2: updating an attribute. 3: deleting an attribute. 4: deleting all attributes. 5: querying attributes. |
token | Yes | String | Unique ID assigned to each device by TPNS. |
attributeInfo | Yes (when cmd is 1, 2, or 3) | Map | Attribute details. See the description of the attributeMap parameter below. |
attributeMap | Yes (when cmd is 1, 2, or 3) | Map | Attribute details: key indicates the attribute name and can contain up to 50 bytes.
Note: you should have created an attribute in the TPNS console > Toolbox > User Attribute Management; otherwise, this parameter will be filtered out, and invalidAttribute will be returned. value indicates the attribute value and can contain up to 50 bytes. |
Parameter | Returned | Type | Description |
retCode | Yes | Integer | |
errMsg | Yes | String | Error message when an error occurs in the request. |
attributeInfo | Yes (when cmd is 5) | Map | Attribute details. |
invalidAttribute | Yes (when the attribute is invalid) | Array | Details of the invalid attribute. |
{"cmd": 1,"token": "04cac74a714f61bf089987a986363d88****","attributeInfo": {"attributeMap": {"age": "100","name": "Ming","high": "2.66"}}}
{"retCode": 0,"errMsg": "success","invalidAttribute": ["high" // The corresponding key value does not exist in the console]}
name attribute to workman.{"cmd": 2,"token": "04cac74a714f61bf089987a986363d88****","attributeInfo": {"attributeMap": {"name": "workman"}}}
{"retCode": 0,"errMsg": "success"}
workman value of the name attribute.{"cmd": 3,"token": "04cac74a714f61bf089987a986363d88****","attributeInfo": {"attributeMap": {"name": "workman"}}}
{"retCode": 0,"errMsg": "success"}
{"cmd": 4,"token": "04cac74a714f61bf089987a986363d88****"}
{"retCode": 0,"errMsg": "success"}
{"cmd": 5,"token": "04cac74a714f61bf089987a986363d88****"}
{"retCode": 0,"errMsg": "success","attributeInfo": {"attributeMap": {"nickname": "workman"}}}
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan