Delete Resource Type
The FHIR conditional delete operation allows you to delete resources of a specific type that match certain search criteria. This is done using an HTTP DELETE request to the endpoint corresponding to the resource type with query parameters.
- CLI
- TypeScript Client
- cURL
Omitting the search parameters deletes every resource of that type
parameters is optional. Leave it out and the server deletes every resource
of the given type, up to its configured delete limit (past which it errors
rather than partially deleting). Always pass search criteria unless that's
genuinely what you want.
To delete Patient resources matching a search:
haste-health api delete-type Patient 'identifier=http://example.org/fhir/ids|12345'
Conditionally delete Patient resources using the TypeScript client:
import { AsynchronousClient } from '@haste-health/client';
import { R4 } from '@haste-health/fhir-types/versions';
// Assuming you have a configured client
const client: AsynchronousClient<{}> = /* ... */;
await client.delete_type(
{},
R4,
'Patient',
'identifier=http://example.org/fhir/ids|12345'
);
console.log('Matching Patient resources deleted');
Conditionally delete Patient resources using cURL:
curl -X DELETE "https://api.haste.health/w/[tenant]/[project]/api/v1/fhir/Patient?identifier=http://example.org/fhir/ids|12345" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Replace [tenant] with your tenant name and [project] with your project ID.