From 3b958f36f70ce86b009c3b942841ca65f4206888 Mon Sep 17 00:00:00 2001 From: Jose Manuel Cantera Date: Tue, 20 Nov 2018 09:17:40 +0100 Subject: [PATCH] First Stab Entity By Id --- examples/EntityList-example.json | 29 ++++++++++ spec/updated/entities-spec.json | 2 +- spec/updated/entity-by-id-spec.json | 87 +++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 examples/EntityList-example.json create mode 100644 spec/updated/entity-by-id-spec.json diff --git a/examples/EntityList-example.json b/examples/EntityList-example.json new file mode 100644 index 0000000..bf4982d --- /dev/null +++ b/examples/EntityList-example.json @@ -0,0 +1,29 @@ +[ + { + "id": "urn:ngsi-ld:Vehicle:V123", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 23, + "accuracy": { + "type": "Property", + "value": 0.7 + }, + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + } + }, + "closeTo": { + "type": "Relationship", + "object": "urn:ngsi-ld:Building:B1234" + }, + "location": { + "type": "GeoProperty", + "value": { + "type":"Point", + "coordinates": [-8,44] + } + } +} +] diff --git a/spec/updated/entities-spec.json b/spec/updated/entities-spec.json index e6793be..346e416 100644 --- a/spec/updated/entities-spec.json +++ b/spec/updated/entities-spec.json @@ -165,7 +165,7 @@ }, "examples": { "simple": { - "externalValue": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/examples/Entity-example.json" + "externalValue": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/examples/EntityList-example.json" } } } diff --git a/spec/updated/entity-by-id-spec.json b/spec/updated/entity-by-id-spec.json new file mode 100644 index 0000000..0ba149f --- /dev/null +++ b/spec/updated/entity-by-id-spec.json @@ -0,0 +1,87 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "NGSI-LD Entity By Id", + "version": "latest" + }, + "components": { + "parameters": { + "entityId": { + "name": "entityId", + "description": "Entity Id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + }, + "type": { + "name": "type", + "description": "Entity Type", + "in": "query", + "required": false, + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name" + } + }, + "attrs": { + "name": "attrs", + "description": "Comma separated list of attribute names (properties or relationships) to be retrieved", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 1 + } + } + } + }, + "paths": { + "/entities/{entityId}": { + "get": { + "description": "Retrieve an specific Entity from an NGSI-LD system. It's possible to specify the Entity attributes to be retrieved by using query parameters", + "operationId": "retrieveEntityById", + "parameters": [ + { + "$ref": "#/components/parameters/entityId" + }, + { + "$ref": "#/components/parameters/attrs" + }, + { + "$ref": "#/components/parameters/type" + }, + + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#" + }, + "examples": { + "simple": { + "externalValue": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/examples/Entity-example.json" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails" + } + } + } + } + } + } + } + } +} -- GitLab