Question

I am confused as to what is the correct one. According to the documentation you can use both APPEND and UPDATE in the field updateAction.

What is the actual difference? How is this related to registerContext?

Was it helpful?

Solution

First of all, APPEND/UPDATE has nothing to do wigh registerContext: APPEND/UPDATE are used in updateContext requests, which is a NGSI10 operation, while registerContext is an NGSI9 operation.

The general rule is to use APPEND when you have to create new context element in Orion Context Broker (e.g. a new entiy or a new attribute in an existing entity) and UPDATE when you are updating an existing context element (e.g. a previously created entity/attribute).

Some additional remarks:

  • An updateContext using UPDATE in a non-existing context element will result in a "Not found" error response.
  • An updateContext using APPEND in a non-existing context element will result in the creation of that element.
  • An updateContext using APPEND in a existing context element will be interpreted as a UPDATE (at least in Orion 0.12.0 and before).

EDIT: Orion 0.24.0 introduces the APPEND_STRICT action, which is like APPEND but returning an error if the attribute to add already exists.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top