From 835e1e45dd2d420ccbd0884f7a3faa377660325b Mon Sep 17 00:00:00 2001
From: Ben Francis
- The WoT Profile Specification defines a Profiling Mechanism and a WoT Core Profile,
+ The WoT Profile Specification defines a Profiling Mechanism and a WoT Core Profile,
which enables out of the box interoperability
among things and devices. Out of the box interoperability implies,
- that devices can be integrated into various application scenarios without
- deep level adaptations. Typically only minor configuration operations are
- necessary (such as entering a network key, or IP address)
- to use the device in a certain scenario.
+ that devices can be integrated into various application scenarios without
+ deep level adaptations. Typically only minor configuration operations are
+ necessary (such as entering a network key, or IP address)
+ to use the device in a certain scenario.
These actions can be done by anyone without specific training.
@@ -977,12 +977,12 @@
array
or
object
- elements. It is RECOMMENDED to keep the nesting
+ elements. It is RECOMMENDED to keep the nesting
of these elements below 4.
@@ -1453,80 +1453,91 @@ - This section describes how the Core Data Model is - bound to different protocols. In addition to a set of - mapping rules, it defines additional behavior, e.g. - timeouts, error behavior, action semantics, etc. -
-readproperty
writeproperty
readallproperties
writeallproperties
readmultipleproperties
writemultipleproperties
+ Other operations under consideration include
+ observeproperty
, unobserveproperty
,
+ observeallproperties
and
+ unobserveallproperties
.
+
+ These operations would require consesus on a default observe + mechanism for HTTP (e.g. Server Sent Events or WebSockets). +
+All communication is using JSON payloads over - HTTP(s). The content type header MUST be set to - "application/json".
- -The HTTP verbs GET and PUT are mapped on - reading and writing a property - all other - protocol verbs return an error "405 Method - Not Allowed".
---Note: Since HTTP does not provide a - pub/sub mechanism, the observe interaction - is not supported directly. The event - mechanism can be used instead to send - notifications on property changes.
-
Multiple properties can be set/get by - accessing the Properties endpoint.
+invokeaction
Actions can be synchronous and asynchronous. - The current TD specification does not - distinguish these two cases and does not - describe a detailed mechanism.
-The HTTP verb POST is mapped to invoking an - action on the actions endpoint - all other - protocol verbs return an error "405 Method - Not Allowed".
+queryaction
, updateaction
and
+ cancelaction
. These operations do not yet exist in
+ the WoT Thing Description specification (see
+
+ #302
+ ).
+ Other operations under consideration include
+ subscribeevent
, unsubscribeevent
,
+ subscribeallevents
, unsubscribeallevents
,
+ readpastevents
and readallpastevents
.
+
+ subscribeevent
, unsubscribeevent
,
+ subscribeallevents
and
+ unsubscribeallevents
would require consensus on a
+ default event subscription mechanism for HTTP (e.g. Server Sent
+ Events or WebSockets).
+
+ subscribeallevents
and
+ unsubscribeallevents
do not yet exist in the WoT Thing
+ Description specification (see
+
+ #1082
+ ).
+
+ readpastevents
and readallpastevents
do
+ not yet exist in the WoT Thing Description specification (see
+
+ #892
+ ).
+
A canonical representation serves multiple purposes. - It is simplifying the parsing process, enables to identify + It is simplifying the parsing process, enables to identify equivalent TDs by simple string comparisons. Furthermore it allows the use of a simple signing mechanism, - such as Linked Data Proofs or JSON Web Signatures [[RFC7515]] and enables - identity checks on encrypted TDs. + such as Linked Data Proofs or JSON Web Signatures [[RFC7515]] and enables + identity checks on encrypted TDs.
The canonical JSON representation format of a TD adopts the JSON Canonicalization Scheme (JCS) defined by @@ -1554,7 +1565,7 @@
+ This section defines a protocol binding which describes how a + Consumer + communicates with a + Web Thing + [[wot-architecture]] using JSON [[JSON]] payloads over + the HTTP [[HTTP11]] protocol. +
++ A Consumer or Web Thing conforming to the WoT Core Profile + MUST implement this protocol binding. +
readproperty
+ The URL of a Property
resource to be used when reading
+ the value of a property MUST be obtained from a Canonical TD by
+ locating a
+
+ Form
inside the corresponding
+
+ PropertyAffordance
+ for which the value of its op
member is
+ readproperty
and the
+ URI
+ scheme [[RFC3986]] of the value of its href
member
+ is http
or https
.
+
+ In order to read the value of a property, a Consumer MUST send + an HTTP request to a Web Thing with: +
GET
Property
resourceAccept
header set to application/json
+
+ GET /things/lamp/properties/on HTTP/1.1 + Host: mythingserver.com + Accept: application/json ++
+ If a Web Thing receives an HTTP request following the format + above and the Consumer has permission to read the corresponding + property, then upon successfully reading the value of the property + it MUST send an HTTP response with: +
200
Content-Type
header set to application/json
+
+ HTTP/1.1 200 OK + Content-Type: application/json + false ++
+ If the property can not be read successfully then the Web Thing + MUST send an HTTP response with an HTTP error code which describes the + reason for the failure. E.g. +
+400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
writeproperty
+ The URL of a Property
resource to be used when writing
+ the value of a property MUST be obtained from a Canonical TD by
+ locating a
+
+ Form
inside the corresponding
+
+ PropertyAffordance
+ for which the value of its op
member is
+ writeproperty
and the
+ URI
+ scheme [[RFC3986]] of the value of its href
member
+ is http
or https
.
+
In order to write the value of a property, a Consumer MUST send + an HTTP request to a Web Thing with: +
PUT
Property
resourceAccept
header set to application/json
+
Content-Type
header set to application/json
+
+ PUT /things/lamp/properties/on HTTP/1.1 + Host: mythingserver.com + Content-Type: application/json + Accept: application/json + true ++
+ If a Web Thing receives an HTTP request following the format + above and the Consumer has permission to write the corresponding + property, then upon successfully writing the value of the + property it MUST send an HTTP response with: +
200
Content-Type
header set to application/json
+
+ HTTP/1.1 200 OK + Content-Type: application/json + true ++
+ If the value of the property can not be written successfully then + the Web Thing MUST send an HTTP response with an HTTP error code + which describes the reason for the failure. E.g. +
+400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
readallproperties
+ The URL of a Properties
resource to be used when
+ reading the value of all properties at once MUST be obtained from a
+ Canonical TD by locating a
+
+ Form
inside the top level
+
+ forms
member
+ for which the value of its op
member is
+ readallproperties
and the
+ URI
+ scheme [[RFC3986]] of the value of its href
member
+ is http
or https
.
+
+ In order to read the value of all properties, a Consumer MUST send + an HTTP request to a Web Thing with: +
GET
Properties
resource
+ Accept
header set to application/json
+
+ GET /things/lamp/properties HTTP/1.1 + Host: mythingserver.com + Accept: application/json ++
+ If a Web Thing receives an HTTP request following the format + above, then upon successfully reading the value of the properties + to which the Consumer has permission to access, it MUST send an HTTP + response with: +
200
Content-Type
header set to application/json
+
+ HTTP/1.1 200 OK + Content-Type: application/json + { + "on": false, + "level": 100 + } ++
+ If the properties can not be read successfully then the Web Thing + MUST send an HTTP response with an HTTP error code which describes + the reason for the failure. E.g. +
+400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
writeallproperties
+ The URL of a Properties
resource to be used when
+ writing the value of all properties at once MUST be obtained from a
+ Canonical TD by locating a
+
+ Form
inside the top level
+
+ forms
member
+ for which the value of its op
member is
+ writeallproperties
and the
+ URI
+ scheme [[RFC3986]] of the value of its href
member
+ is http
or https
.
+
+ In order to write the value of all writable properties at once, + a Consumer MUST send an HTTP request to a Web Thing with: +
PUT
Properties
resource
+ Content-Type
header set to application/json
+
Accept
header set to application/json
+
+ PUT /things/lamp/properties HTTP/1.1 + Host: mythingserver.com + Content-Type: application/json + Accept: application/json + { + "on": true, + "level": 50 + } ++
+ If a Web Thing receives an HTTP request following the format + above, then upon successfully writing the value of the properties + it MUST send an HTTP response with: +
200
Content-Type
header set to application/json
+
+ HTTP/1.1 200 OK + Content-Type: application/json + { + "on": true, + "level": 50 + } ++
+ If the properties can not be written successfully then the Web Thing + MUST send an HTTP response with an HTTP error code which describes + the reason for the failure. E.g. +
+400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
readmultipleproperties
+ The URL of a Properties
resource to be used when
+ reading the value of multiple properties at once MUST be obtained
+ from a Canonical TD by locating a
+
+ Form
inside the top level
+
+ forms
member
+ for which the value of its op
member is
+ readmultipleproperties
and the
+ URI
+ scheme [[RFC3986]] of the value of its href
member
+ is http
or https
.
+
+ In order to read the value of multiple properties, a Consumer MUST + send an HTTP request to a Web Thing with: +
GET
Properties
resource
+ Content-Type
header set to application/json
+
Accept
header set to application/json
+
+ GET /things/lamp/properties HTTP/1.1 + Host: mythingserver.com + Accept: application/json + ["on", "level"] ++
+ If a Web Thing receives an HTTP request following the format + above, then upon successfully reading the values of the properties + it MUST send an HTTP response with: +
200
Content-Type
header set to application/json
+
+ HTTP/1.1 200 OK + Content-Type: application/json + { + "on": false, + "level": 100 + } ++
+ If the properties can not be read successfully then the Web Thing + MUST send an HTTP response with an HTTP error code which describes + the reason for the failure. E.g. +
+400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
writemultipleproperties
+ The URL of a Properties
resource to be used when
+ writing the value of multiple properties at once MUST be obtained
+ from a Canonical TD by locating a
+
+ Form
inside the top level
+
+ forms
member
+ for which the value of its op
member is
+ writemultipleproperties
and the
+ URI
+ scheme [[RFC3986]] of the value of its href
member
+ is http
or https
.
+
+ In order to write the value of multiple properties at once, a + Consumer MUST send an HTTP request to a Web Thing with: +
PUT
Properties
resource
+ Content-Type
header set to application/json
+
Accept
header set to application/json
+
+ PUT /things/lamp/properties HTTP/1.1 + Host: mythingserver.com + Content-Type: application/json + Accept: application/json + { + "on": true, + "level": 50 + } ++
+ If a Web Thing receives an HTTP request following the format + above, then upon successfully writing the value of the properties + it MUST send an HTTP response with: +
200
Content-Type
header set to application/json
+
+ HTTP/1.1 200 OK + Content-Type: application/json + { + "on": true, + "level": 50 + } ++
+ If the properties can not be written successfully then the Web Thing + MUST send an HTTP response with an HTTP error code which describes + the reason for the failure. E.g. +
+400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
@@ -1493,6 +1899,68 @@
writemultipleproperties
invokeaction
+ The URL of an Action
resource to be used when invoking
+ an action MUST be obtained from a Canonical TD by locating a
+
+ Form
inside the corresponding
+
+ ActionAffordance
+ for which the value of its op
member is
+ invokeaction
and the
+ URI
+ scheme [[RFC3986]] of the value of its href
member
+ is http
or https
.
+
In order to invoke an action on a Web Thing, a Consumer MUST send + an HTTP request to the Web Thing with: +
POST
Action
resourceAccept
header set to application/json
+
Content-Type
header set to application/json
+
+ POST /things/lamp/actions/fade HTTP/1.1 + Host: mythingserver.com + Content-Type: application/json + Accept: application/json + { + "level": 100, + "duration": 5 + } ++
+ If a Web Thing receives an HTTP request following the format + above and the Consumer has permission to invoke the corresponding + action, then upon successfully invoking the action it MUST send an + HTTP response with: +
+The response to invoking an action needs to + be defined. Given not all actions can be completed within the + timeout period of an HTTP response, this may need to include a + reference to an action request resource in an action queue (see + + #302). +
++ If the action can not be invoked successfully then + the Web Thing MUST send an HTTP response with an HTTP error code + which describes the reason for the failure. E.g. +
+400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
418 I'm a teapot
500 Internal Server Error
queryaction
, updateaction
and
@@ -1538,6 +2006,7 @@ readallproperties
If a Web Thing receives an HTTP request following the format - above, then upon successfully reading the value of the properties - to which the Consumer has permission to access, it MUST send an HTTP - response with: + above, then upon successfully reading the values of all the + readable properties to which the Consumer has permission to + access, it MUST send an HTTP response with:
200
Content-Type
header set to application/json
@@ -1707,14 +1707,14 @@
writeallproperties
If a Web Thing receives an HTTP request following the format - above, then upon successfully writing the value of the properties - it MUST send an HTTP response with: + above, then upon successfully writing the value of all writable + properties it MUST send an HTTP response with:
200
Content-Type
header set to application/json
@@ -1765,8 +1765,8 @@
readmultipleproperties
Accept
header set to application/json
@@ -1777,14 +1777,14 @@
readmultipleproperties
If a Web Thing receives an HTTP request following the format - above, then upon successfully reading the values of the properties - it MUST send an HTTP response with: + above, then upon successfully reading the values of the requested + readable properties it MUST send an HTTP response with:
200
Content-Type
header set to application/json
@@ -1851,14 +1851,15 @@
writemultipleproperties
If a Web Thing receives an HTTP request following the format - above, then upon successfully writing the value of the properties - it MUST send an HTTP response with: + above, then upon successfully writing the values of the requested + writable properties it MUST send an HTTP response with:
200
Content-Type
header set to application/json
From e2ee023288513996b921d2a9679fd90417659c78 Mon Sep 17 00:00:00 2001 From: Ben FrancisDate: Thu, 6 May 2021 18:19:51 +0100 Subject: [PATCH 4/6] Remove readmultipleproperties and writeallproperties --- index.html | 152 +++-------------------------------------------------- 1 file changed, 8 insertions(+), 144 deletions(-) diff --git a/index.html b/index.html index 76fcd79..2c41f1a 100644 --- a/index.html +++ b/index.html @@ -1664,150 +1664,6 @@
readallproperties
500 Internal Server Error
writeallproperties
- The URL of a Properties
resource to be used when
- writing the value of all properties at once MUST be obtained from a
- Canonical TD by locating a
-
- Form
inside the top level
-
- forms
member
- for which the value of its op
member is
- writeallproperties
and the
- URI
- scheme [[RFC3986]] of the value of its href
member
- is http
or https
.
-
- In order to write the value of all writable properties at once, - a Consumer MUST send an HTTP request to a Web Thing with: -
PUT
Properties
resource
- Content-Type
header set to application/json
-
Accept
header set to application/json
-
- PUT /things/lamp/properties HTTP/1.1 - Host: mythingserver.com - Content-Type: application/json - Accept: application/json - { - "on": true, - "level": 50 - } --
- If a Web Thing receives an HTTP request following the format - above, then upon successfully writing the value of all writable - properties it MUST send an HTTP response with: -
200
Content-Type
header set to application/json
-
- HTTP/1.1 200 OK - Content-Type: application/json - { - "on": true, - "level": 50 - } --
- If the properties can not be written successfully then the Web Thing - MUST send an HTTP response with an HTTP error code which describes - the reason for the failure. E.g. -
-400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
readmultipleproperties
- The URL of a Properties
resource to be used when
- reading the value of multiple properties at once MUST be obtained
- from a Canonical TD by locating a
-
- Form
inside the top level
-
- forms
member
- for which the value of its op
member is
- readmultipleproperties
and the
- URI
- scheme [[RFC3986]] of the value of its href
member
- is http
or https
.
-
- In order to read the value of multiple properties, a Consumer MUST - send an HTTP request to a Web Thing with: -
GET
Properties
resource
- Content-Type
header set to application/json
-
Accept
header set to application/json
-
- GET /things/lamp/properties HTTP/1.1 - Host: mythingserver.com - Accept: application/json - ["on", "level"] --
- If a Web Thing receives an HTTP request following the format - above, then upon successfully reading the values of the requested - readable properties it MUST send an HTTP response with: -
200
Content-Type
header set to application/json
-
- HTTP/1.1 200 OK - Content-Type: application/json - { - "on": false, - "level": 100 - } --
- If the properties can not be read successfully then the Web Thing - MUST send an HTTP response with an HTTP error code which describes - the reason for the failure. E.g. -
-400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
writemultipleproperties
@@ -1894,6 +1750,14 @@
writemultipleproperties
+ readmultipleproperties
is currently excluded due to
+ the complexities of the request payload format and because it
+ doesn't add much functionality over readproperty
and
+ readallproperties
.
+ writeallproperties
is currently excluded because it
+ is just a special case of writemultipleproperties
.
+
writeproperty
200
Content-Type
header set to application/json
-
204
- HTTP/1.1 200 OK - Content-Type: application/json - true + HTTP/1.1 204 No Content
If the value of the property can not be written successfully then @@ -1710,21 +1704,11 @@
writemultipleproperties
200
Content-Type
header set to application/json
-
204
- HTTP/1.1 200 OK - Content-Type: application/json - { - "on": true, - "level": 50 - } + HTTP/1.1 204 No Content
If the properties can not be written successfully then the Web Thing
From aa9d6fe9ca73ba4a9f7673a8f00e0dd98c4976d9 Mon Sep 17 00:00:00 2001
From: Ben Francis
- If the property can not be read successfully then the Web Thing
- MUST send an HTTP response with an HTTP error code which describes the
- reason for the failure. E.g.
-
Content-Type: application/json
false
- readproperty
-
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
writeproperty
writeproperty
HTTP/1.1 204 No Content-
- If the value of the property can not be written successfully then - the Web Thing MUST send an HTTP response with an HTTP error code - which describes the reason for the failure. E.g. -
-400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
readallproperties
readallproperties
- If the properties can not be read successfully then the Web Thing - MUST send an HTTP response with an HTTP error code which describes - the reason for the failure. E.g. -
-400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
writemultipleproperties
writemultipleproperties
HTTP/1.1 204 No Content-
- If the properties can not be written successfully then the Web Thing - MUST send an HTTP response with an HTTP error code which describes - the reason for the failure. E.g. -
-400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
@@ -1797,19 +1749,6 @@
invokeaction
- If the action can not be invoked successfully then - the Web Thing MUST send an HTTP response with an HTTP error code - which describes the reason for the failure. E.g. -
-400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
418 I'm a teapot
500 Internal Server Error
queryaction
, updateaction
and
@@ -1853,6 +1792,37 @@ + If any of the operations defined above are unsuccessful then + the Web Thing MUST send an HTTP response with an HTTP error code which + describes the reason for the failure. It is RECOMMENDED that error + responses use one of the following HTTP error codes: +
+400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
+ Web Things MAY respond with other valid HTTP error codes
+ (e.g. 418 I'm a teapot
), but Consumers MAY interpret
+ those error codes as a generic 4xx
or 5xx
+ error with no special defined behaviour.
+
+ If we define the finite set of error responses as above then we + should also define what a Consumer should do if it receives a 3xx + redirect type response. +
++ If an HTTP error response contains a body, the content of that body + MUST conform with with the Problem Details format [[RFC7807]]. +
+