Skip to content

Latest commit

 

History

History
260 lines (202 loc) · 6.09 KB

batch-operations.md

File metadata and controls

260 lines (202 loc) · 6.09 KB

NGSI-LD Batch operations

This custom node is a simple node that allows to create, upsert, update or delete NGSI-LD entities in a single batch operation. NGSI-LD Entity data shall be provided as part of the msg.payload.

Contents

Details

Create entities

It allows to create NGSI-LD entities.

Properties

Property Description
Name A name for a node instance
Broker An endpoint of NGSI-LD broker
Action type create
@context NGSI-LD @context
Encode forbidden chars off or on

Input

payload JSON Array

A msg.payload should contain NGSI-LD entities as JSON Array.

[
    {
        "id": "urn:ngsi-ld:TemperatureSensor:002",
        "type": "TemperatureSensor",
        "category": {
            "type": "Property",
            "value": "sensor"
        },
        "temperature": {
            "type": "Property",
            "value": 20,
            "unitCode": "CEL"
        }
    },
    {
        "id": "urn:ngsi-ld:TemperatureSensor:003",
        "type": "TemperatureSensor",
        "category": {
            "type": "Property",
            "value": "sensor"
        },
        "temperature": {
            "type": "Property",
            "value": 2,
            "unitCode": "CEL"
        }
    },
    {
        "id": "urn:ngsi-ld:TemperatureSensor:004",
        "type": "TemperatureSensor",
        "category": {
            "type": "Property",
            "value": "sensor"
        },
        "temperature": {
            "type": "Property",
            "value": 100,
            "unitCode": "CEL"
        }
    }
]

Output

statusCode Number

A msg.statusCode contains a status code.

204

Update entities

It allows to update NGSI-LD entities.

Properties

Property Description
Name A name for a node instance
Broker An endpoint of NGSI-LD broker
Action type update
@context NGSI-LD @context
Encode forbidden chars off or on

Input

payload JSON Array

A msg.payload should contain NGSI-LD entities as JSON Array.

[
    {
        "id": "urn:ngsi-ld:TemperatureSensor:002",
        "type": "TemperatureSensor",
        "category": {
            "type": "Property",
            "value": "sensor"
        },
        "temperature": {
            "type": "Property",
            "value": 21,
            "unitCode": "CEL"
        }
    },
    {
        "id": "urn:ngsi-ld:TemperatureSensor:003",
        "type": "TemperatureSensor",
        "category": {
            "type": "Property",
            "value": "sensor"
        },
        "temperature": {
            "type": "Property",
            "value": 27,
            "unitCode": "CEL"
        }
    }
]

Output

statusCode Number

A msg.statusCode contains a status code.

204

Upsert entities

It allows to upsert NGSI-LD entities.

Properties

Property Description
Name A name for a node instance
Broker An endpoint of NGSI-LD broker
Action type upsert
@context NGSI-LD @context
Encode forbidden chars off or on

Input

payload JSON Array

A msg.payload should contain NGSI-LD entities as JSON Array.

[
    {
        "id": "urn:ngsi-ld:TemperatureSensor:002",
        "type": "TemperatureSensor",
        "category": {
            "type": "Property",
            "value": "sensor"
        },
        "temperature": {
            "type": "Property",
            "value": 21,
            "unitCode": "CEL"
        }
    },
    {
        "id": "urn:ngsi-ld:TemperatureSensor:003",
        "type": "TemperatureSensor",
        "category": {
            "type": "Property",
            "value": "sensor"
        },
        "temperature": {
            "type": "Property",
            "value": 27,
            "unitCode": "CEL"
        }
    }
]

Output

statusCode Number

A msg.statusCode contains a status code.

204

Delete entities

It allows to delete NGSI-LD entities.

Properties

Property Description
Name A name for a node instance
Broker An endpoint of NGSI-LD broker
Action type delete
@context NGSI-LD @context
Encode forbidden chars off or on

Input

payload JSON Araay

A msg.payload should contain NGSI-LD entities as JSON Array.

[
    "urn:ngsi-ld:TemperatureSensor:002",
    "urn:ngsi-ld:TemperatureSensor:003",
    "urn:ngsi-ld:TemperatureSensor:004"
]

Output

statusCode Number

A msg.statusCode contains a status code.

204