Reading/Adding device tags

Maybe I’ve missed it in the API documentation and forums, but is there a way to add/remove device tags through the notecard?

Hi @gcutrell,

It’s not documented (yet) but you can get/set device tags by using the _tags environment variable at the device level.

Rob

Thanks @RobLauer. I’m using the arduino library v1.4.5 and notecard v6.1.1. I’ve tried
J *req = notecard.newRequest("env.set"); JAddStringToObject(req, "_tags", "test"); notecard.sendRequest(req);

but I’m getting
{"err":"key name must be specified","time":1}.

Hi @gcutrell,

My apologies - it turns out that device tags are a unique reserved environment variable that can only be set using the Notehub API. They can’t be set on device due to the potential for conflict between what’s set on a device and in Notehub.

1 Like