184
edits
(→Channels: Updated to Decentralized API) |
(→Specific services and channels: Decentralized Taxonomy) |
||
Line 103: | Line 103: | ||
== Time == | == Time == | ||
* Get the current time | * Get the current time | ||
PUT http://localhost:3000/api/v1/channels/get {" | PUT http://localhost:3000/api/v1/channels/get {"feature":"clock/time-of-day-seconds"} | ||
PUT http://localhost:3000/api/v1/channels/get {" | PUT http://localhost:3000/api/v1/channels/get {"feature":"clock/time-timestamp-rfc-3339"} | ||
== Camera == | == Camera == | ||
Line 115: | Line 115: | ||
** PUT http://localhost:3000/api/v1/channels/get {"id":"getter:image_newest.ae67e622-7a66-465e-bab0-28107b2df980@link.mozilla.org"} | ** PUT http://localhost:3000/api/v1/channels/get {"id":"getter:image_newest.ae67e622-7a66-465e-bab0-28107b2df980@link.mozilla.org"} | ||
* Get list of services that can take image (snapshot) | * Get list of services that can take image (snapshot) | ||
** POST http://localhost:3000/api/v1/services {" | ** POST http://localhost:3000/api/v1/services {"channels":[{"kind": "camera/store-snapshot"} }]} | ||
== Recipe == | == Recipe == | ||
Line 134: | Line 134: | ||
conditions: one or more of { | conditions: one or more of { | ||
source: one or more of Selectors (see section on channels) | source: one or more of Selectors (see section on channels) | ||
feature: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/services/enum.ChannelKind.html#json documentation of channel kinds] | |||
range: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Range.html#json documentation of ranges] | range: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Range.html#json documentation of ranges] | ||
duration: (optional) floating point number of seconds | duration: (optional) floating point number of seconds | ||
Line 140: | Line 140: | ||
execute: one or more of { | execute: one or more of { | ||
destination: one or more Selectors (see section on channels) | destination: one or more Selectors (see section on channels) | ||
feature: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/services/enum.ChannelKind.html#json documentation of channel kinds] | |||
value: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Value.html#json documentation of values] | value: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Value.html#json documentation of values] | ||
} | } | ||
Line 161: | Line 161: | ||
"ThinkerbellRule":{ | "ThinkerbellRule":{ | ||
"name":"Hello, Thinkerbell", | "name":"Hello, Thinkerbell", | ||
"source":"{\"name\": \"Hello, Thinkerbell\", \"rules\":[{\"conditions\":[{\"source\":[{\"id\":\"OpenZWave/72057594126794752 (Sensor)\"}],\" | "source":"{\"name\": \"Hello, Thinkerbell\", \"rules\":[{\"conditions\":[{\"source\":[{\"id\":\"OpenZWave/72057594126794752 (Sensor)\"}],\"feature\":\"door/is-open\",\"range\":{\"Eq\":{\"OpenClosed\":\"Open\"}}}],\"execute\":[{\"destination\":[{\"feature\":\"log/append-text\"}],\"feature\":\"log/append-text\",\"value\":{\"String\":\"Closed\"}}]}]}" | ||
} | } | ||
} | } | ||
Line 169: | Line 169: | ||
Example: | Example: | ||
POST http://localhost:3000/api/v1/services HTTP/1.1 {" | POST http://localhost:3000/api/v1/services HTTP/1.1 {"channels": [{"feature": "thinkerbell/source"}]} | ||
== WebPush == | == WebPush == | ||
* Get current subscriptions | * Get current subscriptions | ||
PUT http://localhost:3000/api/v1/channels/get {" | PUT http://localhost:3000/api/v1/channels/get {"feature": "webpush/subscribe"} | ||
* Get current resources receiving notifications on | * Get current resources receiving notifications on | ||
PUT http://localhost:3000/api/v1/channels/get {" | PUT http://localhost:3000/api/v1/channels/get {"feature": "webpush/resource"} | ||
* Add push subscription | * Add push subscription | ||
PUT http://localhost:3000/api/v1/channels/set {"select": {" | PUT http://localhost:3000/api/v1/channels/set {"select": {"feature": "webpush/subscribe"}, | ||
"value": {"Json": {"subscriptions":[{"push_uri":"http://push.service/t54wtresfesfd","public_key":"base64_encoded_key","auth":"optional_base64_auth_data"}]}}} | "value": {"Json": {"subscriptions":[{"push_uri":"http://push.service/t54wtresfesfd","public_key":"base64_encoded_key","auth":"optional_base64_auth_data"}]}}} | ||
* Remove push subscription | * Remove push subscription | ||
PUT http://localhost:3000/api/v1/channels/set {"select": {" | PUT http://localhost:3000/api/v1/channels/set {"select": {"feature": "webpush/unsubscribe"}, | ||
"value": {"Json": {"subscriptions":[{"push_uri":"http://push.service/t54wtresfesfd","public_key":"base64_encoded_key","auth":"optional_base64_auth_data"}]}}} | "value": {"Json": {"subscriptions":[{"push_uri":"http://push.service/t54wtresfesfd","public_key":"base64_encoded_key","auth":"optional_base64_auth_data"}]}}} | ||
Line 261: | Line 260: | ||
=== Examples === | === Examples === | ||
==== Check availability of an individual light ==== | ==== Check availability of an individual light ==== | ||
PUT http://localhost:3000/api/v1/channels/get {"id":" | PUT http://localhost:3000/api/v1/channels/get {"id":"channel:available.4.001788fffe25681a.philips_hue@link.mozilla.org"} | ||
==== Turn all the lights off ==== | ==== Turn all the lights off ==== | ||
PUT http://localhost:3000/api/v1/channels/set {"select":{" | PUT http://localhost:3000/api/v1/channels/set {"select":{"feature":"light/is-on"},"value":{"OnOff":"Off"}} |
edits