You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Common content for the `$bulk-delete` operation
3
+
description: Explains the `$bulk-delete` operation for the FHIR service and the Azure API for FHIR service in Azure Health Data Services.
4
+
ms.service: healthcare-apis
5
+
ms.topic: include
6
+
ms.date: 04/01/2024
8
7
ms.author: kesheth
9
-
ms.custom: "include file"
10
8
---
11
-
`$bulk-delete' allows you to delete resources from FHIR server asynchronously. Bulk delete operation can be executed at system level or for individual resource type.
12
-
* System level: Execution of the operation at system-level enables deletion of FHIR resources across all the resource types in FHIR server.
9
+
10
+
The `$bulk-delete` operation allows you to delete resources from the FHIR server asynchronously. You can execute the `$bulk-delete` operation at the system level or for individual resource types.
11
+
12
+
-**System level**: Execution of the operation at system-level enables deletion of FHIR resources across all the resource types on the FHIR server.
13
13
14
14
```http
15
15
DELETE /$bulkDelete
16
16
```
17
-
* Individual resource type: Execution of the operation at individual resource types allows deletion of FHIR resources mapping to specified resource type in the url.
17
+
18
+
- **Individual resource types**: Execution of the operation for individual resource types allows deletion of FHIR resources that map to the resource type in the URL.
18
19
19
20
```http
20
21
DELETE /<Resource Type>/$bulkDelete
21
22
```
23
+
22
24
> [!NOTE]
23
-
> Bulk delete is a an operation to be used with caution. Resources in FHIR service once deleted cannot be reverted.
25
+
> Use the `$bulk-delete` operation with caution. Deleted resources can't be restored.
24
26
25
-
Bulk delete operation is currently in public preview. Review disclaimer for details.
The `$bulk-delete` operation requires two header parameters:
29
+
30
+
- **Accept**: application/fhir+json
27
31
32
+
- **Prefer**: respond-async
28
33
29
-
## Headers
30
-
Bulk-Delete operation requires two header parameters
31
-
* Accept: application/fhir+json
32
-
* Prefer: respond-async
34
+
## Role requirements
35
+
36
+
- To perform the `$bulk-delete` operation, a user or application needs to be assigned to the `FHIR Data Writer` role.
37
+
38
+
- To perform the `$bulk-delete` operation with a hard delete query parameter, a user or application needs to be assigned to the `FHIR Data Contributor` role.
33
39
34
-
## Query Parameters
35
-
Query parameters allow you to filter raw resources you intend to delete. To support filtering, FHIR service query parameters are:
40
+
## Query parameters
41
+
42
+
Query parameters allow you to filter the raw resources you plan to delete.
43
+
44
+
To support filtering, the query parameters are:
36
45
37
46
|Query parameter | Default Value | Description|
38
47
|------------------------|---|------------|
39
-
|_hardDelete|False|For deletion of resource including history version, pass value true.|
40
-
|_purgeHistory|False|Allows to delete history versions associated with resource.|
41
-
|FHIR service supported search parameters||Allows to specify search criteria and resources matching the search criteria are deleted.Example: address:contains=Meadow subject:Patient.birthdate=1987-02-20|
48
+
|_hardDelete|False|Allows you to hard delete a resource. If you don't pass this parameter or set hardDelete to false, the historic versions of the resource are still available.|
49
+
|_purgeHistory|False|Allows you to delete history versions associated with resource.|
50
+
|FHIR service supported search parameters||Allows you to specify search criteria and resources matching the search criteria are deleted. For example: `address:contains=Meadow subject:Patient.birthdate=1987-02-20`|
42
51
43
52
All the query parameters are optional.
44
53
45
-
## $bulk-delete Response
46
-
After request is made to bulk delete FHIR resources, in response you should receive Content-Location header with the absolute URL of an endpoint for subsequent status requests, such as a polling endpoint.
54
+
## `$bulk-delete` operation response
55
+
56
+
After a request is made to bulk delete FHIR resources, in response you receive a Content-Location header with the absolute URL of an endpoint for subsequent status requests, such as a polling endpoint.
57
+
58
+
## Polling endpoint
59
+
60
+
Request to the polling endpoint is one of the four outcomes depending on the status of the `$bulk-delete` job. The outcome is provided within OperationOutcome of the FHIR response.
61
+
62
+
1. **Jobs in progress**: This outcome states the job is in progress. Status Code 202.
47
63
48
-
**Polling endpoint:**
49
-
Request to polling endpoint has one of the four outcomes depending on the status of the bulk-delete job. The outcome is provided within OperationOutcome of FHIR response
50
-
1. Jobs in progress: This outcome states the job is in progress. Status Code 202
51
-
2. Completed: This outcome states the job has successfully completed. At completion, the information of number of resources deleted would be provided at individual resource type level. Status code 200
52
-
3. Canceled: This outcome states job is canceled by the user and provides information on number of resources delete at individual resource type level. Status code 200
53
-
4. Failed: This outcome states job has failed. Status code depends on failure type.
64
+
1. **Completed**: This outcome states the job completed successfully. At completion, the information about the number of resources deleted is provided at individual resource type level. Status code 200.
65
+
66
+
1. **Canceled**: This outcome states the user canceled the job and provides information on the number of resources deleted at the individual resource level. Status code 200.
67
+
68
+
1. **Failed**: This outcome states the job failed. Status code depends on the failure type.
54
69
55
70
Sample request and response for determining the status
56
-
Request:
71
+
request:
72
+
57
73
```
58
74
{{fhir_url}}/_operations/bulk-delete/<id>
59
75
```
60
-
Sample response of successfully completed delete job.
76
+
Here's a sample response for a successfully completed delete job:
|500 |Connection to database failed | Create a gitsupport ticket to resolve the issue.|
110
+
|429 |Throttling errors | For Azure API for FHIR, you can increase RUs and retry the job. For Azure Health Data Services FHIR Server, you can try to delete a smaller amount of data at a time. |
111
+
112
+
## FAQ
113
+
114
+
- My `$bulk-delete` job seems to be stuck. What are the steps for resolution?<br/><br/> To check if a `$bulk-delete` job is stuck, run a FHIR search with the same parameters as the bulk delete job and _summary=count. If the count of resources is going down, the job is working. You can also cancel the `$bulk-delete` job and try again.
115
+
116
+
- Do API interactions see any latency impact when a `$bulk-delete` operation job is executed concurrently?<br/><br/>When you run a `$bulk-delete` operation, you might see increased latency on concurrent calls to the service. To avoid a latency increase, we recommend that you cancel the `$bulk-delete` job, and then rerun it during a period of lower traffic.
117
+
118
+
> [!NOTE]
119
+
> If you cancel and then restart a `$bulk-delete` operation, the deletion process resumes from where it was stopped.
0 commit comments