Skip to content

Commit

Permalink
Merge pull request #806 from telefonicaid/task/add-ngsi-patching-id-type
Browse files Browse the repository at this point in the history
Add NGSI patching type and id documentation
  • Loading branch information
fgalan committed Feb 2, 2024
2 parents e2cd004 + 2fd7f8d commit e0d9fa0
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions docs/usermanual.md
Expand Up @@ -116,10 +116,47 @@ tools available online like [this one](https://string-functions.com/string-hex.a

It is possible report as a measure a NGSI-v2 or NGSI-LD payload when related device/group is configured with
`payloadType` `ngsiv2` or `ngsild`. In these cases payload is ingested as measure where entity attributes are measure
attributes and `id` and `type` are ignored, since `id` and `type` from device/group configuration provisioned are used,
as well as `actionType`.
attributes.

Examples of these `ngsiv2` payloads are the following ones:
Note that the entity ID and type in the measure are also include as attributes `measure_id` and `measure_type` as described
[here](https://github.dev/telefonicaid/iotagent-node-lib/doc/api.md#special-measures-and-attributes-names) (both using
attribute type `Text`). The ID and type of the entity updated at Context Broker is taken from device/group configuration or provision,

However, it is possible to use the same entity ID that the original one by using `entityNameExp`
at [device group provision](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/api.md#config-group-datamodel), this way:

```
"entityNameExp": "measure_id"
```

The `actionType` used in the update sent to Context Broker is taken from the measure in the case that measure corresponds to
a NGSI-v2 batch update. In other cases (i.e. NGSI-LD or NGSI-v2 non-batch update), the `actionType` is the default one (`append`).

For instance, given an incoming **measure** as the follwing one:

```json
{
"id": "MyEntityId1",
"type": "MyEntityType1",
"attr1": { "type": "Text", "value": "MyAttr1Value"}
}
```

It would persist an entity into the Context Broker like the following one:

```json
{
"id":"MyProvisionID",
"type":"MyProvisionType",
"attr1": { "type": "Text", "value": "MyAttr1Value"},
"measure_id": {"type": "Text","value": "MyEntityId1"},
"measure_type":{"type": "Text","value": "MyEntityType1"}
}
```

The IoTA is able to ingest different types of `NGSI-V2` and `NGSI-LD` payloads like the following ones:

**NGSI-V2**

(1) NGSI-v2 batch update format:

Expand Down Expand Up @@ -171,7 +208,7 @@ Examples of these `ngsiv2` payloads are the following ones:
}
```

Example of these `ngsild` payloads are the following ones:
**NGSI-LD**

(1) NGSI-LD entities array format:

Expand Down

0 comments on commit e0d9fa0

Please sign in to comment.