FIWARE Entities API
The Entities API from FIWARE — 11 operation(s) for entities.
The Entities API from FIWARE — 11 operation(s) for entities.
openapi: 3.0.3
info:
description: This OAS file describes the NGSI-LD API defined by the ETSI ISG CIM group. This Cross-domain Context Information Management API allows to provide, consume and subscribe to context information in multiple scenarios and involving multiple stakeholders
version: latest
title: ETSI ISG CIM / NGSI-LD API Entry Point Entities API
contact:
email: NGSI-LD@etsi.org
tags:
- name: Entities
paths:
/entities/:
get:
description: Retrieve a set of entities which matches a specific query from an NGSI-LD system
operationId: queryEntities
tags:
- Entities
parameters:
- $ref: '#/components/parameters/id'
- $ref: '#/components/parameters/idPattern'
- $ref: '#/components/parameters/type'
- $ref: '#/components/parameters/attrs'
- $ref: '#/components/parameters/q'
- $ref: '#/components/parameters/georel'
- $ref: '#/components/parameters/geometry'
- $ref: '#/components/parameters/coordinates'
- $ref: '#/components/parameters/geoproperty'
- $ref: '#/components/parameters/csf'
- $ref: '#/components/parameters/limit'
- $ref: '#/components/parameters/options'
responses:
'200':
description: OK
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/EntityList'
examples:
simple:
externalValue: https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/examples/EntityList-example.json
'400':
description: Bad request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
post:
description: Create a new Entity within an NGSI-LD system
operationId: createEntity
tags:
- Entities
requestBody:
required: true
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/Entity'
responses:
'201':
description: Created. Contains the resource URI of the created Entity
'400':
description: Bad request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'409':
description: Already exists
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'422':
description: Unprocessable Entity
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/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
tags:
- Entities
parameters:
- $ref: '#/components/parameters/entityId'
- $ref: '#/components/parameters/attrs'
- $ref: '#/components/parameters/parameters-type'
- $ref: '#/components/parameters/options'
responses:
'200':
description: OK
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/Entity'
examples:
simple:
externalValue: https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/examples/Entity-example.json
'400':
description: Bad request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'404':
description: Not Found
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
delete:
description: Removes an specific Entity from an NGSI-LD system
operationId: removeEntityById
tags:
- Entities
parameters:
- $ref: '#/components/parameters/entityId'
- $ref: '#/components/parameters/parameters-type'
responses:
'204':
description: No Content. The entity was removed successfully
'400':
description: Bad Request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'404':
description: Not Found
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/entities/{entityId}/attrs/:
post:
description: Append new Entity attributes to an existing Entity within an NGSI-LD system
operationId: appendEntityAttrs
tags:
- Entities
parameters:
- $ref: '#/components/parameters/entityId'
- $ref: '#/components/parameters/parameters-options'
requestBody:
required: true
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/EntityFragment'
responses:
'204':
description: No Content
'207':
description: Partial Success. Only the attributes included in the response payload were successfully appended
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/UpdateResult'
'400':
description: Bad request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'404':
description: Not Found
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
patch:
description: Update existing Entity attributes within an NGSI-LD system
operationId: updateEntityAttrs
tags:
- Entities
parameters:
- $ref: '#/components/parameters/entityId'
requestBody:
required: true
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/EntityFragment'
responses:
'204':
description: No Content.
'207':
description: Partial Success. Only the attributes included in the response payload were successfully updated
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/UpdateResult'
'400':
description: Bad Request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'404':
description: Not Found
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/entities/{entityId}/attrs/{attrId}:
patch:
description: Update existing Entity attributes within an NGSI-LD system
operationId: partialAttrUpdate
tags:
- Entities
parameters:
- $ref: '#/components/parameters/entityId'
- $ref: '#/components/parameters/attrId'
requestBody:
required: true
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/EntityFragment'
responses:
'204':
description: No Content.
'400':
description: Bad Request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'404':
description: Not Found
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
delete:
description: Removes an existing Entity attribute within an NGSI-LD system
operationId: removeEntityAttr
tags:
- Entities
parameters:
- $ref: '#/components/parameters/entityId'
- $ref: '#/components/parameters/attrId'
responses:
'204':
description: No Content.
'400':
description: Bad Request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'404':
description: Not Found
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/entityOperations/create:
post:
description: Batch Entity creation
operationId: batchEntityCreation
tags:
- Entities
requestBody:
required: true
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/EntityList'
responses:
'200':
description: Success
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/BatchOperationResult'
'400':
description: Bad request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/entityOperations/update:
post:
description: Batch Entity update
operationId: batchEntityUpdate
tags:
- Entities
parameters:
- name: options
in: query
required: false
schema:
type: string
enum:
- noOverwrite
requestBody:
required: true
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/EntityList'
responses:
'200':
description: Success
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/BatchOperationResult'
'400':
description: Bad request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/entityOperations/upsert:
post:
description: Batch Entity upsert
operationId: batchEntityUpsert
tags:
- Entities
parameters:
- name: options
in: query
required: false
schema:
type: string
enum:
- replace
- update
requestBody:
required: true
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/EntityList'
responses:
'200':
description: Success
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/BatchOperationResult'
'400':
description: Bad request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/entityOperations/delete:
post:
description: Batch Entity delete
operationId: batchEntityDelete
tags:
- Entities
requestBody:
required: true
content:
application/json;application/ld+json:
schema:
type: array
items:
type: string
format: uri
minItems: 1
responses:
'200':
description: Success
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/BatchOperationResult'
'400':
description: Bad request
content:
application/json;application/ld+json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/v2/entities:
get:
description: "Retrieves a list of entities that match different criteria by id, type, pattern matching (either id or type)\nand/or those which match a query or geographical query (see [Simple Query Language](#simple_query_language) and \n[Geographical Queries](#geographical_queries)). A given entity has to match all the criteria to be retrieved\n(i.e., the criteria is combined in a logical AND way). Note that pattern matching query parameters are incompatible\n(i.e. mutually exclusive) with their corresponding exact matching parameters, i.e. `idPattern` with `id` and\n`typePattern` with `type`.\nThe response payload is an array containing one object per matching entity. Each entity follows\nthe JSON entity representation format (described in \"JSON Entity Representation\" section).\nResponse code:\n* Successful operation uses 200 OK\n* Errors use a non-2xx and (optionally) an error payload. See subsection on \"Error Responses\" for\n more details."
summary: List Entities
tags:
- Entities
operationId: List Entities
produces:
- application/json
parameters:
- name: id
in: query
required: false
type: string
description: 'A comma-separated list of elements.
Retrieve entities whose ID matches one of the elements in the list.
Incompatible with `idPattern`.'
- name: type
in: query
required: false
type: string
description: 'comma-separated list of elements.
Retrieve entities whose type matches one of the elements in the list.
Incompatible with `typePattern`.'
- name: idPattern
in: query
required: false
type: string
description: 'A correctly formated regular expression.
Retrieve entities whose ID matches the regular expression. Incompatible with `id`.'
- name: typePattern
in: query
required: false
type: string
description: 'A correctly formated regular expression.
Retrieve entities whose type matches the regular expression. Incompatible with `type`.'
- name: q
in: query
required: false
type: string
description: 'A query expression, composed of a list of statements
separated by `;`, i.e., q=statement1;statement2;statement3.
See [Simple Query Language specification](#simple_query_language).'
- name: mq
in: query
required: false
type: string
description: 'A query expression for attribute metadata,
composed of a list of statements separated by `;`, i.e., mq=statement1;statement2;statement3.
See [Simple Query Language specification](#simple_query_language).'
- name: georel
in: query
required: false
type: string
description: 'Spatial relationship between matching entities and a
reference shape. See [Geographical Queries](#geographical_queries).'
- name: geometry
in: query
required: false
type: string
description: 'Geografical area to which the query is restricted.
See [Geographical Queries](#geographical_queries).'
- name: coords
in: query
required: false
type: string
description: 'List of latitude-longitude
pairs of coordinates separated by '';''. See [Geographical Queries](#geographical_queries).'
- name: limit
in: query
required: false
type: number
format: double
exclusiveMaximum: false
exclusiveMinimum: false
description: Limits the number of entities to be retrieved
- name: offset
in: query
required: false
type: number
format: double
exclusiveMaximum: false
exclusiveMinimum: false
description: Establishes the offset from where entities are retrieved
- name: attrs
in: query
required: false
type: string
description: 'Comma-separated list of attribute names whose data
are to be included in the response.
The attributes are retrieved in the order specified by this parameter. If this parameter is
not included, the attributes are retrieved in arbitrary order.
See "Filtering out attributes and metadata" section for more detail.'
- name: metadata
in: query
required: false
type: string
description: 'A list of metadata names to include in the response.
See "Filtering out attributes and metadata" section for more detail.'
- name: orderBy
in: query
required: false
type: string
description: 'Criteria for ordering results.
See "Ordering Results" section for details.'
- name: options
in: query
required: false
enum:
- count
- keyValues
- values
- unique
x-enum-elements:
- name: count
description: ''
- name: keyValues
description: ''
- name: values
description: ''
- name: unique
description: ''
type: string
description: Options dictionary
responses:
'200':
description: ''
schema:
type: array
items:
$ref: '#/definitions/ListEntitiesResponse'
examples:
application/json:
- type: Room
id: DC_S1-D41
temperature:
value: 35.6
type: Number
metadata: {}
- type: Room
id: Boe-Idearium
temperature:
value: 22.5
type: Number
metadata: {}
- type: Car
id: P-9873-K
speed:
value: 100
type: number
metadata:
accuracy:
value: 2
type: Number
timestamp:
value: '2015-06-04T07:20:27.378Z'
type: DateTime
x-unitTests:
- request:
method: GET
uri: /v2/entities?id=Boe_Idearium&type=Room&idPattern=Bode_.*&typePattern=Room_.*&q=temperature>40&mq=temperature.accuracy<0.9&georel=near&geometry=point&coords=41.390205,2.154007;48.8566,2.3522&limit=20&offset=20&attrs=seatNumber&metadata=accuracy&orderBy=temperature,!speed
expectedResponse:
x-allowExtraHeaders: true
x-bodyMatchMode: RAW
x-arrayOrderedMatching: false
x-arrayCheckCount: false
x-matchResponseSchema: true
headers:
Content-Type: application/json
body: '[ { "type": "Room", "id": "DC_S1-D41", "temperature": { "value": 35.6, "type": "Number", "metadata": {} } }, { "type": "Room", "id": "Boe-Idearium", "temperature": { "value": 22.5, "type": "Number", "metadata": {} } }, { "type": "Car", "id": "P-9873-K", "speed": { "value": 100, "type": "number", "metadata": { "accuracy": { "value": 2, "type": "Number" }, "timestamp": { "value": "2015-06-04T07:20:27.378Z", "type": "DateTime" } } } }]'
x-testShouldPass: true
x-testEnabled: true
x-testName: List Entities1
x-testDescription: "Retrieves a list of entities that match different criteria by id, type, pattern matching (either id or type)\nand/or those which match a query or geographical query (see [Simple Query Language](#simple_query_language) and \n[Geographical Queries](#geographical_queries)). A given entity has to match all the criteria to be retrieved\n(i.e., the criteria is combined in a logical AND way). Note that pattern matching query parameters are incompatible\n(i.e. mutually exclusive) with their corresponding exact matching parameters, i.e. `idPattern` with `id` and\n`typePattern` with `type`.\nThe response payload is an array containing one object per matching entity. Each entity follows\nthe JSON entity representation format (described in \"JSON Entity Representation\" section).\nResponse code:\n* Successful operation uses 200 OK\n* Errors use a non-2xx and (optionally) an error payload. See subsection on \"Error Responses\" for\n more details."
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
post:
description: "The payload is an object representing the entity to be created. The object follows\nthe JSON entity representation format (described in a \"JSON Entity Representation\" section).\nResponse:\n* Successful operation uses 201 Created (if upsert option is not used) or 204 No Content (if\n upsert option is used). Response includes a `Location` header with the URL of the\n created entity.\n* Errors use a non-2xx and (optionally) an error payload. See subsection on \"Error Responses\" for\n more details."
summary: Create Entity
tags:
- Entities
operationId: Create Entity
produces:
- application/json
parameters:
- name: Content-Type
in: header
required: true
type: string
description: ''
- name: body
in: body
required: true
description: ''
schema:
$ref: '#/definitions/CreateEntityRequest'
- name: options
in: query
required: false
enum:
- keyValues
- upsert
x-enum-elements:
- name: keyValues
description: ''
- name: upsert
description: ''
type: string
description: Options dictionary
responses:
'204':
description: ''
x-unitTests:
- request:
method: POST
uri: /v2/entities
headers:
Content-Type: application/json
body: '{ "type": "Room", "id": "Bcn-Welt", "temperature": { "value": 21.7 }, "humidity": { "value": 60 }, "location": { "value": "41.3763726, 2.1864475", "type": "geo:point", "metadata": { "crs": { "value": "WGS84" } } }}'
expectedResponse:
x-allowExtraHeaders: true
x-bodyMatchMode: NONE
x-arrayOrderedMatching: false
x-arrayCheckCount: false
x-matchResponseSchema: true
headers:
Location: /v2/entities/Bcn-Welt?type=Room
x-testShouldPass: true
x-testEnabled: true
x-testName: Create Entity1
x-testDescription: "The payload is an object representing the entity to be created. The object follows\nthe JSON entity representation format (described in a \"JSON Entity Representation\" section).\nResponse:\n* Successful operation uses 201 Created (if upsert option is not used) or 204 No Content (if\n upsert option is used). Response includes a `Location` header with the URL of the\n created entity.\n* Errors use a non-2xx and (optionally) an error payload. See subsection on \"Error Responses\" for\n more details."
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
/v2/entities/{entityId}:
get:
description: 'The response is an object representing the entity identified by the ID. The object follows
the JSON entity representation format (described in "JSON Entity Representation" section).
This operation must return one entity element only, but there may be more than one entity with the
same ID (e.g. entities with same ID but different types).
In such case, an error message is returned, with the HTTP status code set to 409 Conflict.
Response:
* Successful operation uses 200 OK
* Errors use a non-2xx and (optionally) an error payload. See subsection on "Error Responses" for more details.'
summary: Retrieve Entity
tags:
- Entities
operationId: Retrieve Entity
produces:
- application/json
parameters:
- name: entityId
in: path
required: true
type: string
description: Id of the entity to be retrieved
- name: type
in: query
required: false
type: string
description: 'Entity type, to avoid ambiguity in case there are several
entities with the same entity id.'
- name: attrs
in: query
required: false
type: string
description: 'Comma-separated list of attribute names whose
data must be included in the response. The attributes are retrieved in the order specified by
this parameter. See "Filtering out attributes and metadata" section for more detail.
If this parameter is not included, the attributes are retrieved in arbitrary order, and all
the attributes of the entity are included in the response.'
- name: metadata
in: query
required: false
type: string
description: 'A list of metadata names to include in the response.
See "Filtering out attributes and metadata" section for more detail.'
- name: options
in: query
required: false
enum:
- keyValues
- values
- unique
x-enum-elements:
- name: keyValues
description: ''
- name: values
description: ''
- name: unique
description: ''
type: string
description: Options dictionary
responses:
'200':
description: ''
schema:
$ref: '#/definitions/RetrieveEntityResponse'
examples:
application/json:
type: Room
id: Bcn_Welt
temperature:
value: 21.7
type: Number
humidity:
value: 60
type: Number
location:
value: 41.3763726, 2.1864475
type: geo:point
metadata:
crs:
value: WGS84
type: Text
x-unitTests: []
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
delete:
description: "Delete the entity.\nResponse:\n* Successful operation uses 204 No Content\n* Errors use a non-2xx and (optionally) an error payload. See subsection on \"Error Responses\" for\n more details."
summary: Remove Entity
tags:
- Entities
operationId: Remove Entity
produces:
- application/json
parameters:
- name: entityId
in: path
required: true
type: string
description: Id of the entity to be deleted
- name: type
in: query
required: false
type: string
description: 'Entity type, to avoid ambiguity in case there are several
entities with the same entity id.'
responses:
'204':
description: ''
x-unitTests: []
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
/v2/entities/{entityId}/attrs:
get:
description: "This request is similar to retreiving the whole entity, however this one omits the `id` and `type`\nfields.\nJust like the general request of getting an entire entity, this operation must return only one\nentity element. If more than one entity with the same ID is found (e.g. entities with\nsame ID but different type), an error message is returned, with the HTTP status code set to\n409 Conflict.\nResponse:\n* Successful operation uses 200 OK\n* Errors use a non-2xx and (optionally) an error payload. See subsection on \"Error Responses\" for\n more details."
summary: Retrieve Entity Attributes
tags:
- Entities
operationId: Retrieve Entity Attributes
produces:
- application/json
parameters:
- name: entityId
in: path
required: true
type: string
description: Id of the entity to be retrieved
- name: type
in: query
required: false
type: string
description: 'Entity type, to avoid ambiguity in case there are several
entities with the same entity id.'
- name: attrs
in: query
required: false
type: string
description: 'Comma-separated list of attribute names whose
data are to be included in the response. The attributes are retrieved in the order specified
by this parameter.
If this parameter is not included, the attributes are retrieved in arbitrary order, and all
the attributes of the entity are included in the response.
See "Filtering out attributes and metadata" section for more detail.'
- name: metadata
in: query
required: false
type: string
description: 'A list of metadata names to include in the response.
See "Filtering out attributes and metadata" section for more detail.'
- name: options
in: query
required: false
enum:
- keyValues
- values
- unique
x-enum-elements:
- name: keyValues
description: ''
- name: values
description: ''
- name: unique
description: ''
type: string
description: Options dictionary
responses:
'200':
description: ''
schema:
$ref: '#/definitions/RetrieveEntityAttributesResponse'
examples:
application/json:
temperature:
value: 21.7
type: Number
humidity:
value: 60
type: Number
location:
value: 41.3763726, 2.1864475
type: geo:point
metadata:
crs:
value: WGS84
type: Text
x-unitTests: []
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
put:
description: "The request payload is an object representing the new entity attributes. The object follows\nthe JSON entity representation format (described in a \"JSON Entity Representation\" above), except\nthat `id` and `type` are not allowed.\nThe attributes previously existing in the entity are removed and replaced by the ones in the\nrequest.\nResponse:\n* Successful operation uses 204 No Content\n* Errors use a non-2xx and (optionally) an error payload. See subsection on \"Error Responses\" for\n more details."
summary: Replace all entity attributes
tags:
- Entities
operationId: Replace all entity attributes
produces:
- application/json
parameters:
- name: entityId
in: path
required: true
type: string
description: Id of the entity in question.
- name: Content-Type
in: header
required: true
type: string
description: ''
- name: body
in: body
required: true
description: ''
schema:
$ref: '#/definitions/ReplaceAllEntityAttributesRequest'
- name: type
in: query
required: false
type: string
description: 'Entity type, to avoid ambiguity in case there are several
entities with the same entity id.'
- name: options
in: query
required: false
enum:
- keyValues
x-enum-elements:
- name: keyValues
description: ''
type: string
description: Operations options
responses:
'204':
description: ''
x-unitTests: []
x-operation-settings:
# --- truncated at 32 KB (52 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/fiware/refs/heads/main/openapi/fiware-entities-api-openapi.yml