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
Note: The CLI delete command only supports deleting individual resource instances, not conditional deletion by type. For conditional deletion, use the TypeScript client or cURL.
To delete a single Patient resource:
haste-health api delete-type Patient
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/r4/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.