Skip to main content

Append

Append is POST /entities/{id}/attrs. It answers 204, or 207 when some attributes are left unwritten.

Append adds the attributes in the body. By default it overwrites an attribute that is already there, so a value you append replaces the old one without a warning.

POST /ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:A4567/attrs
Content-Type: application/json

{
"colour": {
"type": "Property",
"value": "red"
}
}
HTTP/1.1 204 No Content

With ?options=noOverwrite, an attribute the entity already has keeps its value. The new attributes are still written. When some attributes are left unwritten, the answer is 207 with an updated list and a notUpdated list, which gives the reason for each one. In Rust, the call takes .overwrite(Overwrite::Keep), and the outcome is UpdateOutcome::Partial when some attributes were left out.

POST /ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:A4567/attrs?options=noOverwrite
Content-Type: application/json

{
"colour": {
"type": "Property",
"value": "blue"
}
}

Update writes the same way. It changes the attributes the entity has and adds the ones it doesn't. The difference is noOverwrite, which only an append has, to keep an attribute the entity already holds.

What gets refused​

  • 404 ResourceNotFound when the entity doesn't exist.
  • 207 when some attributes were left unwritten, as with noOverwrite. Each entry in notUpdated carries its reason.
  • Everything in the common list.