Delete a record or restore it
Delete a record into its key domain’s recycle bin, and restore it from there. A deleted record stays restorable until someone shreds it.
Who can do this: a domain owner of the record’s key domain.
The samples use the allowed helper from Access decisions.
1. Delete the record
Without a version, objects.delete retires every version of the record.
await allowed(await client.objects.delete({ locator }));try await allowed(client.objects.delete(ObjectRef(locator: locator)))allowed(client.objects.delete(ObjectRef(locator)))| Deny reason | When | What to do |
|---|---|---|
held | A legal hold covers the record. | Wait for the hold to lift. |
retention | The dataset’s retention floor still applies. | Wait until the floor passes. |
2. List the recycle bin
const bin = await client.domains.recycleBin(root);let bin = try await client.domains.recycleBin(root)val bin = client.domains.recycleBin(root)3. Restore the item
const item = bin.find((i) => i.locator === locator)!;await allowed(await client.domains.restore(item));let item = bin.first { $0.locator == locator }!try await allowed(client.domains.restore(item))val item = bin.first { it.locator == locator }allowed(client.domains.restore(item))The record is live again in its folder.
Next
- Delete and restore for single versions, whole key domains and
shred, which is final.