plantbreeding / BrAPI

Repository for version control of the BrAPI specifications
https://brapi.org
MIT License
57 stars 32 forks source link

DELETE endpoints for the whole spec #614

Open BrapiCoordinatorSelby opened 2 months ago

BrapiCoordinatorSelby commented 2 months ago

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 and POST /delete/images for potential examples

daveneti commented 2 months ago

Adding delete endpoints is a simple one line configuration change in the Specification generator:

dmeidlin commented 2 months ago

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.

Production Considerations that Favor POST over DELETE

Production Considerations that Favor DELETE over POST

Developers

Intermediary Servers (load balancers, API Gateways, reverse proxies, WAFs, caches, etc.)

Automated Deployment/DevOps Services

Required Features for Batch Delete

Considerations for Batch Delete

Considerations for POST-based

Post-based and DELETE-based

DELETE-based Implementation

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:

Each BrAPI variable would need a DELETE endpoint for deleting a single instance of the BrAPI variable.