Open BrapiCoordinatorSelby opened 2 months ago
Adding delete endpoints is a simple one line configuration change in the Specification generator:
After looking over the POST-based batch delete specification for observations and images, and after considering the risks and benefits of either a POST-based or DELETE-based specification for processing batch deletion, a DELETE-based specification is more favorable especially when considering the roles of intermediary servers in a production environment. Also, full CRUD operations would be necessary for the client to create a batch for deletion, review the batch, make any changes to the batch, and finally delete the batch. Here is an outline of the main points.
The risk of unintended consequences when intermediary servers handle deletions with POST request favors implementing batch deletions using a DELETE endpoint specifically for deleting a collection of BrAPI entities. The client will generally need all CRUD operations for processing batch deletions:
<BrAPIVariable>SearchRequest
object, but instead of carrying out the deletion operation it creates a collection of <BrAPIVariable>
for deletion and responds with either a just DeletionCollectionDbId
or with a DeletionCollectionDbId
and the collection itself.<deletionCollectionDbId>
: The current contents of the deletion collection are returned either for getting the results of the original POST as in a search request, or the client wants to review the current contents of the deletion collection.<deletionCollectionDbId>
: The request body contains a JSON object of key-value pairs where the key is a <BrAPIVariable>DbId
and value is a boolean flag to add/remove the entity from the deletion collection. This enables the client to make any changes after the review but prior to deletion. The response contains the state of the deletion collection after the update.<deletionCollectionDbId>
: The entities in the deletion collection are deleted and the response contains an instance of <BrAPIVariable>DeleteResponse
containing the unique ids of the <BrAPIVariable>
entities that were successfully deleted.Each BrAPI variable would need a DELETE endpoint for deleting a single instance of the BrAPI variable.
<BrAPIVariable>
/<BrAPIVariableDbId>
: It responds with the entity that was successfully deleted.
Create a way to delete entities via the API.
Remember this is a REQUEST to delete entities, a server can handle it however it wants to. There is no expectation that anything will be permanently deleted out of a database.
See
POST /delete/observations
andPOST /delete/images
for potential examples