We are trying to decide on how we handle removing a resource from a collection (not the actual deletion of the resource in the system, but removing the association from the collection). I have perused the group a bit, but did not find an answer to this, but if I missed it, please feel free to point me to that answer.
For example:
- resource: /accounts
- collection: /accounts/{id}/contacts
- The semantics of contacts are the list of current person objects where the current date is within the valid_from date and valid_to date on each object.
When we delete a contact, we must be able to specify an end date.
Here are the options we have come up with..
PUT /accounts/{id}/contacts/{contact_id} payload contains the updated: valid_to
DELETE /accounts/{id}/contacts/{contact_id} deletes the reference to the account
POST /accounts/{id}/contacts/{contact_id}/remove payload contains the updated: valid_to deletes the reference to the account
DELETE /accounts/{id}/contacts/{contact_id}?end_date=<date> Use the query parameter to set the valid_to and then remove the reference to the account
PATCH /accounts/{id}/contacts/{contact_id} payload would be a patch payload to update the valid_to date and delete the reference to to the account
Because we add to this collection with
POST /accounts/{id}/contacts
it seems to make sense to remove the item from the collection using
DELETE /accounts/{id}/contacts/{contact_id}?end_date=<date>
But the issue is that we must be able to set the date to a date different than the current date.
So, I am asking this here to see what the consensus is - if there is one.
Thanks,
Jeff