6. Layer 1 - Access
❖ Based on REST and
Resource Oriented
Architecture
❖ Extend with Pub/Sub
➢ MQTT,
➢ XMPP
➢ CoAP
7. Layer 2 - Find
❖ How do we enable users to find the right
service for their application?
❖ Enabling Smart Things to be indexed by
search engines.
➢ microdata
➢ schema.org
➢ Swagger
➢ JSON-LD
8. Layer 3 - Share
❖ How do we share smart things with friends?
❖ Social Access Controller (SAC) as proxy between clients and smart things.
9. Layer 4 - Compose
❖ How do we enable their easy
composition by non-specialists into
new applications?
❖ Physical Mashups
❖ Tools
➢ IFTTT
➢ Node-RED
➢ WoT-a-Mashup
11. Web Things integration patterns (2)
❖基於Gateway連接
➢ 當裝置無法提供internet protocol時,只能先透過其他協定例如CoAP與Router連結後,再把資
料由Router回傳給Client端。
12. Web Things integration patterns (3)
❖基於雲端服務連接
➢ 與第2種類似,把Router替換成雲端服務,再透過雲端server與各個WoT連結。
13. Web Things requirements - Must Should
May❖A Web Thing must at least be an HTTP/1.1 server.
❖A Web Thing must have a root resource accessible via an HTTP URL.
❖A Web Thing must support GET, POST, PUT and DELETE HTTP verbs.
❖A Web Thing must implement HTTP status codes 200, 400, 500.
➢ 2XX Success. 4XX Client Error. 5XX Server Error.
❖A Web Thing must support JSON as default representation.
➢ include error message
❖A Web Thing must support GET on its root URL.
EXAMPLE : Valid root URLs
http://gateway.api.com/devices/TV
http://kitchen-raspberry.device-lab.co.uk
https://192.168.10.10:9002
https://kitchen:3000/fridge/root
14. Web Things requirements - Must Should
May❖A Web Thing should use secure HTTP connections (HTTPS).
❖A Web Thing should implement the WebSocket Protocol.
❖A Web Thing should support the Web Things model.
❖A Web Thing should return a 204 for all write operations.
➢ By default, all PUT, POST, and DELETE requests to a Web Thing should return a 204 NO
CONTENT response and no response body.
❖A Web Thing should provide a default human-readable documentation.
15. Web Things requirements - Must Should
May❖A Web Thing may support the HTTP OPTIONS verb for each of its resources.
❖A Web Thing may provide additional representation mechanisms (RDF, XML,
JSON-LD).
❖A Web Thing may offer a HTML-based user interface.
❖A Web Thing may provide precise information about the intended meaning of
individual parts of the model.
16. Web Thing Model
❖The Web Thing follows the Web Things Requirements.
❖The Web Things model is a contract between clients and Things in the IoT.
URL Description
{wt} The root resource URL
{wt}/model/ The model of a Web Thing
{wt}/properties/ The list of properties
{wt}/properties/{id} A specific property
{wt}/actions/ The list of actions
{wt}/actions/{id} A specific action
{wt}/actions/{id}/{actionId} A specific execution of an action
{wt}/.../ ...
end-points exaples
17. Web Thing Model - Common Constructs
EXAMPLE 2: Basic JSON payload
{
"id": "myCar", // required
"name": "My great car", // A short human-readable name for the resource.
"description": "This is such a great car.", // A human-readable description of the resource.
"createdAt": "2012-08-24T17:29:11.683Z", // Timestamp when this resource was created
"updatedAt": "2012-08-24T17:29:11.683Z", // Timestamp when this resource was last updated.
"tags": [ // An array of tags.
"cart",
"device",
"test"
],
"customFields": { // A JSON object with key-value pairs to store custom information about this resource.
"size": "20",
"color": "blue"
},
"links": { // A JSON object that lists the sub-resources that this resource links to.
"model": {
"link": "model/",
"title": "Model this Web Thing."
},
"properties": {
"link": "properties/",
"title": "Properties of this Web Thing."
},
"actions": {
"link": "actions/",
"title": "Actions of this Web Thing."
},
...
}
}
18. Example - Retrieve a Web Thing
EXAMPLE 8: Get the Root Resource of a Web Thing
--> REQUEST
GET {wt}
<-- RESPONSE
200 OK
Link: <model/>; rel="model"
Link: <properties/>; rel="properties"
Link: <actions/>; rel="actions"
Link: <product/>; rel="product"
Link: <type/>; rel="type"
Link: <help/>; rel="help"
Link: <ui/>; rel="ui"
Link: <_myCustomLinkRelType/>; rel="_myCustomLinkRelType"
{
"id": "myCar",
"name": "My super great car",
"description": "This is such a great car.",
"createdAd": "2012-08-24T17:29:11.683Z",
"updatedAd": "2012-08-24T17:29:11.683Z",
"tags":["cart", "device", "test"],
"customFields":{
"size": "20",
"color":"blue"
}
}
19. Example - Update a Web Thing
EXAMPLE 9: Update my super great car
--> REQUEST
PUT {wt}
{
"name":"My really super great car"
}
<-- RESPONSE
204 NO CONTENT
20. Example - Retrieve a list of actions
EXAMPLE 15: List of actions
--> REQUEST
GET {wt}/actions
<-- RESPONSE
200 OK
Link: <http://webofthings.org/actions/upgradefirmware>; rel="type"
[
{
"id":"upgradeFirmware",
"name":"Upgrade Device Firmware"
},
{
"id":"reboot",
"name":"Reboot"
}
]
21. Example - Execute an action
EXAMPLE 17: Schedule a reboot
--> REQUEST
POST {wt}/actions/reboot
{
"delay":50,
"mode":"debug"
}
<-- RESPONSE
204 NO RESPONSE
Location: {wt}/actions/reboot/233