Skip to main content

Delete

Delete removes an attribute, one instance of it, or a whole entity, with DELETE /entities/{id}/attrs/{attrId} or DELETE /entities/{id}. It answers 204, or 404 ResourceNotFound when there is nothing to delete.

The first request deletes the attribute speed, and the second deletes the entity:

DELETE /ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:A4567/attrs/speed
DELETE /ngsi-ld/v1/entities/urn:ngsi-ld:Vehicle:A4567

Each answers 204, or 404 ResourceNotFound when there is nothing to delete. Without a query parameter, an attribute delete removes only its default instance. Two parameters change that.

  • ?datasetId= deletes one instance of the attribute.
  • ?deleteAll=true deletes every instance.

Sending both is refused because they contradict each other. deleteAll removes every instance, and datasetId names one. In Rust the two are one choice, InstanceSelection::Dataset(&uri) or InstanceSelection::All, passed to .instances(...), so asking for both can't be written.

What gets refused​

  • 404 ResourceNotFound when the entity, or the attribute, doesn't exist.
  • 400 BadRequestData when datasetId and deleteAll=true are sent together.

To remove members inside a value, use merge with the NGSI-LD Null on each one.