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

From MozillaWiki
Jump to navigation Jump to search
(+ Channel tags)
Line 11: Line 11:


== Services ==
== Services ==
=== List of Services ===
 
Services may requested by selector. A service selector is an object with the following fields:
Services may requested by selector. A service selector is an object with the following fields:


Line 19: Line 19:
* (optional) object or array of objects `setters` (see SetterSelector): accept only services with channels matching all the selectors in this array.
* (optional) object or array of objects `setters` (see SetterSelector): accept only services with channels matching all the selectors in this array.


The GET accepts 0, 1 or an array of service selectors and will return all the services that match any of the selectors.
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).


=== List of Services ===
Example with 1 selector:
Example with 1 selector:


Line 35: Line 36:
* Get all services:
* Get all services:
** GET http://localhost:3000/api/v1/services
** GET http://localhost:3000/api/v1/services
== Tags ==
* Assign Tags to a service
** POST http://localhost:3000/api/v1/services/tags {"services": selector(s), "tags": tag(s)}
* Remove Tags of a service
** DELETE http://localhost:3000/api/v1/services/tags {"services": selector(s), "tags": tag(s)}
* Example
** POST http://localhost:3000/api/v1/services/tags {"services":[{"id":"thinkerbell-root-service"}],"tags":["Living Room"] }


== Channels ==
== Channels ==
Line 50: Line 62:
While each field is optional, at least one field must be provided.
While each field is optional, at least one field must be provided.


Generally, '''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 73: Line 85:


See http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Value.html for the full documentation on values.
See http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Value.html for the full documentation on values.
=== Tags ===
* Assign Tags to a channel
** POST http://localhost:3000/api/v1/channels/getter/tags {"getter": selector(s), "tags": tag(s)}
** POST http://localhost:3000/api/v1/channels/setter/tags {"setter": selector(s), "tags": tag(s)}
* Remove Tags of a channel
** DELETE http://localhost:3000/api/v1/channels/getter/tags {"getter": selector(s), "tags": tag(s)}
** DELETE http://localhost:3000/api/v1/channels/setter/tags {"setter": selector(s), "tags": tag(s)}


= Specific services and channels =
= Specific services and channels =
Line 89: Line 112:
** POST http://localhost:3000/api/v1/services {"setters":[{"kind":{"adapter":"Adapter","kind":"snapshot","type": "Json", "vendor":"DLink"} }]}
** POST http://localhost:3000/api/v1/services {"setters":[{"kind":{"adapter":"Adapter","kind":"snapshot","type": "Json", "vendor":"DLink"} }]}


== Tags ==
* Assign Tags to a service
** POST http://localhost:3000/api/v1/services/tags {"services":[{"id":"thinkerbell-root-service"}],"tags":["Living Room"] }
** Note: there can be multiple tags, (in array)
* Remove Tags of a service
** DELETE http://localhost:3000/api/v1/services/tags {"services":[{"id":"thinkerbell-root-service"}],"tags":["Living Room"] }
** Same URL, same body
* Query all devices matching the tag
** POST http://localhost:3000/api/v1/services {"tags":["Living"]}
== Recipe ==
== Recipe ==
* Send Recipe
* Send Recipe

Revision as of 17:09, 1 April 2016

Taxonomy Documentation

Github Link: http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/index.html

Current REST API

Account

Services

Services may requested by selector. A service selector is an object with the following fields:

  • (optional) string `id`: accept only a service with a given id;
  • (optional) string array of string `tags`: accept only services with all the tags in the array;
  • (optional) object or array of objects `getters` (see GetterSelector): accept only services with channels matching all the selectors in this array;
  • (optional) object or array of objects `setters` (see SetterSelector): accept only services with channels matching all the selectors in this array.

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).

List of Services

Example with 1 selector:

  • Get services with tag "location: kitchen" and channel kind "OvenTemperature"

Example with 2 selectors:

As a shortcut, providing no argument will locate all services:

Tags

Channels

Channels are designed to be used by selector.

A selector is an object with the following fields:

  • (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|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|object `kind` (see ChannelKind): accept only channels of a given kind.

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).


Fetching


Example:

Sending

or

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

Tags


Specific services and channels

Time

Camera

Recipe

  • Send Recipe
  • List available Recipes

WebPush