NGSI entity
This custom node is a simple node that allows to create, read, upsert or delete an NGSIv2 entity.
Create an entity
It allows to create a NGSIv2 entity.
Properties
name
: A name for a node instanceContext Broker
: An endpoint of a context brokerServicePath
: FIWARE Service PathAction type
:create
Representation
: normalized or keyValuesEncode / Decode forbidden chars
:off
oron
Input
payload JSON Object
A msg.payload
should contain an entity to create.
{
"id": "E",
"type": "T",
"temperature": {
"type": "Number",
"value": 25,
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2023-02-10T20:33:53.199Z"
}
}
},
"relativeHumidity": {
"type": "Number",
"value": 45,
"metadata": {}
},
"atmosphericPressure": {
"type": "Number",
"value": 1003.5,
"metadata": {}
}
}
Output
statusCode Number
A msg.statusCode
contains a status code.
201
Read an entity
It allows to read a NGSIv2 entity.
Properties
name
: A name for a node instanceContext Broker
: An endpoint of a context brokerServicePath
: FIWARE Service PathAction type
:read
Entity id
: id of an entity to be readEntity type
: type of an entity to be readattributes
: list of attributes of an entity to be readRepresentation
: normalized or keyValuesDate Modified
: retrieve attribute and metadata of dateModifiedEncode / Decode forbidden chars
:off
oron
Input
payload string or JSON Object
A msg.payload
should contain an entity Id to read the NGSI v2 entity.
urn:ngsi-ld:Building:store001
A msg.payload
should contain a condition to read the NGSI v2 entity.
{
"id": "urn:ngsi-ld:Building:store001",
"type": "Building",
"attrs": "humidity",
"keyValues": true,
"dateModified": false
}
Output
payload JSON Object
A msg.payload
contains the NGSIv2 entity.
{
"id": "E1",
"type": "T",
"humidity": {
"type": "Number",
"value": 51,
"metadata": {}
},
"temperature": {
"type": "Number",
"value": 25,
"metadata": {}
}
}
statusCode Number
A msg.statusCode
contains a status code.
200
Upsert an entity
It allows to upsert a NGSIv2 entity.
Properties
name
: A name for a node instanceContext Broker
: An endpoint of a context brokerServicePath
: FIWARE Service PathAction type
:upsert
Representation
: normalized or keyValuesEncode / Decode forbidden chars
:off
oron
Input
payload JSON Object
A msg.payload
should contain an entity to upsert.
{
"id": "E",
"type": "T",
"temperature": {
"type": "Number",
"value": 25,
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2023-02-10T20:33:53.199Z"
}
}
},
"relativeHumidity": {
"type": "Number",
"value": 45,
"metadata": {}
},
"atmosphericPressure": {
"type": "Number",
"value": 1003.5,
"metadata": {}
}
}
Output
statusCode Number
A msg.statusCode
contains a status code.
204
Delete an entity
It allows to delete a NGSIv2 entity.
Properties
name
: A name for a node instanceContext Broker
: An endpoint of a context brokerServicePath
: FIWARE Service PathAction type
:delete
Entity id
: id of an entity to be deletedEntity type
: type of an entity to be deletedEncode / Decode forbidden chars
:off
oron
Input
payload string or JSON Object
A msg.payload
should contain an entity Id to delete the NGSI v2 entity.
urn:ngsi-ld:Building:store001
A msg.payload
should contain a condition to delete the NGSI v2 entity.
{
"id": "urn:ngsi-ld:Building:store001",
"type": "Building",
}
Output
statusCode Number
A msg.statusCode
contains a status code.
204
Use value of actionType in payload
It allows to create, read, upsert or delete a NGSIv2 entity.
Properties
name
: A name for a node instanceContext Broker
: An endpoint of a context brokerServicePath
: FIWARE Service PathAction type
:value of actionType in payload
Entity id
: Id of an entity to be created, read, upserted or deletedEntity type
: Type of an entity to be created, read, upserted or deletedRepresentation
: normalized or keyValuesDate Modified
: retrieve attribute and metadata of dateModifiedEncode / Decode forbidden chars
:off
oron
Input (create)
payload JSON Object
When creating an entity, a msg.payload
should contain a JSON Object with actionType
and entity
.
{
"actionType": "create",
"entity": {
"id": "E",
"type": "T",
"temperature": {
"type": "Number",
"value": 25,
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2023-02-10T20:33:53.199Z"
}
}
},
"relativeHumidity": {
"type": "Number",
"value": 45,
"metadata": {}
},
"atmosphericPressure": {
"type": "Number",
"value": 1003.5,
"metadata": {}
}
}
}
Output (create)
statusCode Number
A msg.statusCode
contains a status code.
201
Input (read)
payload JSON Object
When reading an entity, a msg.payload
should contain a JSON Object with actionType
and related information the entity to be read.
{
"actionType": "read",
"id": "E",
"type": "T"
}
Output (read)
payload JSON Object
A msg.payload
contains an object representing the entity.
{
"type":"Number",
"value":45,
"metadata":{}
}
statusCode Number
A msg.statusCode
contains a status code.
200
Input (upsert)
payload JSON Object
When upserting an entity, a msg.payload
should contain a JSON Object with actionType
and entity
.
{
"actionType": "upsert",
"entity": {
"id": "E",
"type": "T",
"temperature": {
"type": "Number",
"value": 29,
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2023-02-10T20:33:53.199Z"
}
}
},
"relativeHumidity": {
"type": "Number",
"value": 58,
"metadata": {}
},
"atmosphericPressure": {
"type": "Number",
"value": 1234.5,
"metadata": {}
}
}
}
Output (upsert)
statusCode Number
A msg.statusCode
contains a status code.
204
Input (delete)
payload JSON Object
When deleting an entity, a msg.payload
should contain a JSON Object with actionType
and related information the entity to be deleted.
{
"actionType": "delete",
"id": "E",
"type": "T"
}
Output (delete)
statusCode Number
A msg.statusCode
contains a status code.
204