Reputation: 6532
I want to DELETE all entities /v2/entities?type=person I do not want do it one by one.
In SQL it will look like
DELETE from person
Currently I can delete only one entity per call with this: DELETE /v2/entities/{id}?type={entityType}
How to delete everything?
Upvotes: 1
Views: 418
Reputation: 12294
You can use batch update to delete several entities at the same time. However, you need to know the particular entity ids to delete.
Deteling all the entities of a given type is not currently supported in the Orion API, but it is in our roadmap. If you are interested in this functionality and what to show your support, please give it a +1 to the github issue about it.
As workaround if you have access to the MongoDB instance used by Orion you can do the following operation to remove all entities of a given type (assuming you are using orion
as DB):
echo 'db.entities.remove({"_id.type": "Person"})' | mongo orion --quiet
EDIT: the following script can be useful to delete all entities (of a given type and/or matching a given filter) at Orion through the NGSIv2 API (i.e. no need to have access to DB directly).
https://github.com/telefonicaid/fiware-orion/blob/master/scripts/utils/delete_entities.py
Use it with care ;)
Upvotes: 1