Connected Devices/Projects/Project Link/Taxonomy: Difference between revisions

→‎Channels: + Feature is now required
(→‎Specific services and channels: Decentralized Taxonomy)
(→‎Channels: + Feature is now required)
Line 53: Line 53:
A selector is an object with the following fields:
A selector is an object with the following fields:


* (required for Fetch/Send, optional in other cases) string `feature`: accept only channels that implement a given feature (e.g. "oven/temperature-celcius")
* (optional) string id: accept only a channel with a given id;
* (optional) string id: accept only a channel with a given id;
* (optional) string `service`: accept only channels of a service with a given id;
* (optional) string `service`: accept only channels of a service with a given id;
* (optional) string|array of string `tags`: accept only channels with all the tags in the array;
* (optional) string|array of string `tags`: accept only channels with all the tags in the array;
* (optional) string|array of string `service_tags`: accept only channels of a service with all the tags in the array;
* (optional) string|array of string `service_tags`: accept only channels of a service with all the tags in the array;
* (optional) string `feature`: accept only channels that implement a given feature (e.g. "oven/temperature-celcius").


While each field is optional, at least one field must be provided.


Generally, except for (de)assigning tags, '''using an id is considered a bad idea''', as this ties the application to a specific device, and this will fail if the device is replaced (consider that this is equivalent to using an IP address instead of a domain name).
Generally, except for (de)assigning tags, '''using an id is considered a bad idea''', as this ties the application to a specific device, and this will fail if the device is replaced (consider that this is equivalent to using an IP address instead of a domain name).
Line 82: Line 81:


* Send a bunch of values to all channels matching any of the selectors:
* Send a bunch of values to all channels matching any of the selectors:
     PUT http://localhost:3000/api/v1/channels/set [{"select": selector(s), "value": value}, {"select": selector(s), "value: value}, ...]
     PUT http://localhost:3000/api/v1/channels/set [{"select": selector(s), "value": value}, {"select": selector(s), "value": value}, ...]
 
Values are defined by Adapters, so you should check the documentation of individual adapters to see what is possible.


See http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Value.html for the full documentation on values.


==== Example (with CURL) ====
==== Example (with CURL) ====
184

edits