Tags
Updated at:
Device tags are key-value pairs that store static, extended information about a device, such as its manufacturer and model number.
Send a message to update device tags
To update device tags, send a message that contains the tag information. This information consists of one or more attrKey and attrValue pairs. The payload is a JSON array that can contain multiple {"attrKey":"","attrValue":""} pairs. An attrKey can contain uppercase letters, lowercase letters, and digits. It cannot start with a digit and must be 2 to 32 bytes long. For example:
/* The device has two tags. The first has an attrKey of "abc" and an attrValue of "Hello,World". The second has an attrKey of "def" and an attrValue of "Hello,Aliyun". */
char *payload = "[{\"attrKey\":\"abc\",\"attrValue\":\"Hello,World\"},{\"attrKey\":\"def\",\"attrValue\":\"Hello,Aliyun\"}]";
/* After you prepare the payload, call the following API operation to send the report. */
IOT_Linkkit_Report(devid, ITM_MSG_DEVICEINFO_UPDATE, (unsigned char *)payload, strlen(payload));Send a message to delete device tags
To delete device tags, send a message that specifies the attrKey of one or more tags.
/* Specifies two tag keys to delete: "abc" and "def". */
char *payload = "[{\"attrKey\":\"abc\"},{\"attrKey\":\"def\"}]";
/* After you prepare the payload, call the following API operation to send the report. */
IOT_Linkkit_Report(devid, ITM_MSG_DEVICEINFO_DELETE, (unsigned char *)payload, strlen(payload));
Is this page helpful?