thing.tag.add
The thing.tag.add command is used to add tag(s) to Thing(s).
TR50 Request
{
"cmd": {
"command": "thing.tag.add",
"params": {
"thingKey": "mything",
"tags": ["tag1", "tag2"]
}
}
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
thingKey | String or Array | Yes* | Identifies the Thing(s) that the tags will be added to. |
thingId | |||
thingTag | |||
thingAll | Boolean | ||
thingQuery | String | The functionality of the "thingQuery" parameter is the same as the "query" parameter for thing.search command. See Documentation. | |
*One of the above parameters is required to identify the thing. If omitted, the thingKey associated with your session will be used. | |||
tags | Array | Yes | The array of tags to be added to the Thing. |
TR50 Response
If the command is sent successfully a success message is returned. Otherwise, an error and error message will be returned.
{
"cmd": {
"success": true
}
}
C API
// basic API
int tr50_thing_tag_add(void *tr50, const char *tags[], const int count);
// extended API
int tr50_thing_tag_add_ex(void *tr50, const char *tags[], const int count, void* optional_params, void** optional_reply, char** error_msg);
JAVA API
// Synchronous
int tagAdd(String[] thingKey, Object response, String... tags);
// Asynchronous
int tagAdd(String[] thingKey, DwOpenReceiveActionListener recv, Object response, String... tags);
Response Objects: StringReply, DwOpenResponse