diff --git a/directory.td.json b/directory.td.json index 657a02d1..623ff3f1 100644 --- a/directory.td.json +++ b/directory.td.json @@ -3,7 +3,7 @@ "http://www.w3.org/ns/td", "https://w3c.github.io/wot-discovery/context/discovery-context.jsonld" ], - "@type": "DirectoryDescription", + "@type": "ThingDirectory", "title": "Thing Description Directory (TDD)", "version": { "instance": "1.0.0-alpha" @@ -52,8 +52,69 @@ }, "security": "combo_sc", "base": "https://tdd.example.com", + "properties": { + "things": { + "description": "Collection of Thing Descriptions in the directory", + "uriVariables": { + "offset": { + "title": "Number of TDs to skip before the page", + "type": "number", + "default": 0 + }, + "limit": { + "title": "Number of TDs in a page", + "type": "number" + }, + "sort_by": { + "title": "Comparator TD attribute for collection sorting", + "type": "string", + "default": "id" + }, + "sort_order": { + "title": "Sorting order", + "type": "string", + "enum": ["asc", "desc"], + "default": "asc" + } + }, + "forms": [ + { + "href": "/things", + "htv:methodName": "GET", + "response": { + "description": "Success response", + "htv:statusCodeValue": 200, + "contentType": "application/td+json" + }, + "scopes": "readAll" + }, + { + "href": "/things{?offset,limit,sort_by,sort_order}", + "htv:methodName": "GET", + "response": { + "description": "Success response", + "htv:statusCodeValue": 200, + "contentType": "application/ld+json", + "htv:headers": [ + { + "htv:fieldName": "Link" + } + ] + }, + "additionalResponses": [ + { + "description": "Invalid query arguments", + "contentType": "application/problem+json", + "htv:statusCodeValue": 400 + } + ], + "scopes": "readAll" + } + ] + } + }, "actions": { - "createTD": { + "createThing": { "description": "Create a Thing Description", "uriVariables": { "id": { @@ -64,7 +125,7 @@ }, "forms": [ { - "href": "/td/{id}", + "href": "/things/{id}", "htv:methodName": "PUT", "contentType": "application/td+json", "response": { @@ -81,16 +142,15 @@ "scopes": "write" }, { - "href": "/td", + "href": "/things", "htv:methodName": "POST", "contentType": "application/td+json", "response": { "description": "Success response", "htv:headers": [ { - "description": "System-generated UUID (version 4) URN", - "htv:fieldName": "Location", - "htv:fieldValue": "" + "description": "System-generated URI", + "htv:fieldName": "Location" } ], "htv:statusCodeValue": 201 @@ -106,8 +166,8 @@ } ] }, - "updateTD": { - "description": "Update a Thing Description", + "retrieveThing": { + "description": "Retrieve an individual Thing Description by its ID", "uriVariables": { "id": { "title": "Thing Description ID", @@ -115,28 +175,34 @@ "format": "iri-reference" } }, + "output" : { + "type": "object", + "description": "The retrieved Thing Description" + }, + "safe": true, + "idempotent": true, "forms": [ { - "href": "/td/{id}", - "htv:methodName": "PUT", - "contentType": "application/td+json", + "href": "/things/{id}", + "htv:methodName": "GET", "response": { "description": "Success response", - "htv:statusCodeValue": 204 + "htv:statusCodeValue": 200, + "contentType": "application/td+json" }, "additionalResponses": [ { - "description": "Invalid serialization or TD", + "description": "TD with the given id not found", "contentType": "application/problem+json", - "htv:statusCodeValue": 400 + "htv:statusCodeValue": 404 } ], - "scopes": "write" - } + "scopes": "read" + }, ] }, - "updatePartialTD": { - "description": "Update parts of a Thing Description", + "updateThing": { + "description": "Update a Thing Description", "uriVariables": { "id": { "title": "Thing Description ID", @@ -146,9 +212,9 @@ }, "forms": [ { - "href": "/td/{id}", - "htv:methodName": "PATCH", - "contentType": "application/merge-patch+json", + "href": "/things/{id}", + "htv:methodName": "PUT", + "contentType": "application/td+json", "response": { "description": "Success response", "htv:statusCodeValue": 204 @@ -158,19 +224,14 @@ "description": "Invalid serialization or TD", "contentType": "application/problem+json", "htv:statusCodeValue": 400 - }, - { - "description": "TD with the given id not found", - "contentType": "application/problem+json", - "htv:statusCodeValue": 404 } ], "scopes": "write" - } + }, ] }, - "deleteTD": { - "description": "Delete a Thing Description", + "partialUpdateThing": { + "description": "Update a Thing Description", "uriVariables": { "id": { "title": "Thing Description ID", @@ -180,13 +241,19 @@ }, "forms": [ { - "href": "/td/{id}", - "htv:methodName": "DELETE", + "href": "/things/{id}", + "htv:methodName": "PATCH", + "contentType": "application/merge-patch+json", "response": { "description": "Success response", "htv:statusCodeValue": 204 }, "additionalResponses": [ + { + "description": "Invalid serialization or TD", + "contentType": "application/problem+json", + "htv:statusCodeValue": 400 + }, { "description": "TD with the given id not found", "contentType": "application/problem+json", @@ -196,11 +263,9 @@ "scopes": "write" } ] - } - }, - "properties": { - "retrieveTD": { - "description": "Retrieve a Thing Description", + }, + "deleteThing": { + "description": "Delete a Thing Description", "uriVariables": { "id": { "title": "Thing Description ID", @@ -210,12 +275,11 @@ }, "forms": [ { - "href": "/td/{id}", - "htv:methodName": "GET", + "href": "/things/{id}", + "htv:methodName": "DELETE", "response": { "description": "Success response", - "htv:statusCodeValue": 200, - "contentType": "application/td+json" + "htv:statusCodeValue": 204 }, "additionalResponses": [ { @@ -224,66 +288,7 @@ "htv:statusCodeValue": 404 } ], - "scopes": "read" - } - ] - }, - "retrieveTDs": { - "description": "Retrieve all Thing Descriptions", - "uriVariables": { - "offset": { - "title": "Number of TDs to skip before the page", - "type": "number", - "default": 0 - }, - "limit": { - "title": "Number of TDs in a page", - "type": "number" - }, - "sort_by": { - "title": "Comparator TD attribute for collection sorting", - "type": "string", - "default": "id" - }, - "sort_order": { - "title": "Sorting order", - "type": "string", - "enum": ["asc", "desc"], - "default": "asc" - } - }, - "forms": [ - { - "href": "/td", - "htv:methodName": "GET", - "response": { - "description": "Success response", - "htv:statusCodeValue": 200, - "contentType": "application/ld+json" - }, - "scopes": "readAll" - }, - { - "href": "/td{?offset,limit,sort_by,sort_order}", - "htv:methodName": "GET", - "response": { - "description": "Success response", - "htv:statusCodeValue": 200, - "contentType": "application/ld+json", - "htv:headers": [ - { - "htv:fieldName": "Link" - } - ] - }, - "additionalResponses": [ - { - "description": "Invalid query arguments", - "contentType": "application/problem+json", - "htv:statusCodeValue": 400 - } - ], - "scopes": "readAll" + "scopes": "write" } ] }, @@ -295,6 +300,8 @@ "type": "string" } }, + "safe": true, + "idempotent": true, "forms": [ { "href": "/search/jsonpath?query={query}", @@ -323,6 +330,8 @@ "type": "string" } }, + "safe": true, + "idempotent": true, "forms": [ { "href": "/search/xpath?query={query}", @@ -351,6 +360,8 @@ "type": "string" } }, + "safe": true, + "idempotent": true, "forms": [ { "href": "/search/sparql?query={query}", @@ -361,7 +372,7 @@ }, "additionalResponses": [ { - "description": "JSONPath expression not provided or contains syntax errors", + "description": "SPARQL query not provided or contains syntax errors", "contentType": "application/problem+json", "htv:statusCodeValue": 400 } @@ -389,43 +400,71 @@ } }, "events": { - "registration": { - "description": "TD registration events", - "uriVariables": { - "type": { - "title": "Event type(s)", - "description": "Multiple types passed as type={type} pairs for SSE", - "type": "string", - "enum": [ - "create", - "update", - "delete" - ] - }, - "full": { - "title": "Include TD changes inside event data", - "type": "boolean" - } - }, - "forms": [ - { - "op": "subscribeevent", - "href": "/events{?type,full}", - "subprotocol": "sse", - "contentType": "text/event-stream", - "htv:headers": [ - { - "description": "ID of the last event provided by reconnecting clients", - "htv:fieldName": "Last-Event-ID" - } - ], - "data": { - "description": "Partial or complete TD", - "type": "object" - }, - "scopes": "notifications" - } - ] + "thingCreated": { + "title": "Thing created", + "data": { + "description": "Partial or complete TD", + "type": "object" + }, + "forms": [ + { + "op": "subscribeevent", + "href": "/events?type=thingCreated", + "subprotocol": "sse", + "contentType": "text/event-stream", + "htv:headers": [ + { + "description": "ID of the last event for reconnection", + "htv:fieldName": "Last-Event-ID", + } + ], + "scopes": "notifications" + } + ] + }, + "thingUpdated": { + "title": "Thing updated", + "data": { + "description": "Partial or complete TD", + "type": "object" + }, + "forms": [ + { + "op": "subscribeevent", + "href": "/events?type=thingUpdated", + "subprotocol": "sse", + "contentType": "text/event-stream", + "htv:headers": [ + { + "description": "ID of the last event for reconnection", + "htv:fieldName": "Last-Event-ID", + } + ], + "scopes": "notifications" + } + ] + }, + "thingDeleted": { + "title": "Thing deleted", + "data": { + "description": "Partial or complete TD", + "type": "object" + }, + "forms": [ + { + "op": "subscribeevent", + "href": "/events?type=thingDeleted", + "subprotocol": "sse", + "contentType": "text/event-stream", + "htv:headers": [ + { + "description": "ID of the last event for reconnection", + "htv:fieldName": "Last-Event-ID", + } + ], + "scopes": "notifications" + } + ] } } -} \ No newline at end of file +}