Skip to content

Commit 698e733

Browse files
Merge pull request #286665 from KendalBond007/FHIReditsBatch12_Sep24
FHIReditsBatch12
2 parents 24c5cb4 + 7f5123b commit 698e733

File tree

5 files changed

+108
-99
lines changed

5 files changed

+108
-99
lines changed

articles/healthcare-apis/fhir/rest-api-capabilities.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ In this article, we cover some of the nuances of the RESTful interactions of the
1515

1616
## Conditional create/update
1717

18-
The FHIR service supports create, conditional create, update, and conditional update as defined by the FHIR specification. One useful header in these scenarios is the [If-Match](https://www.hl7.org/fhir/http.html#concurrency) header. The `If-Match` header is used and validates the version being updated before making the update. If the `ETag` doesn’t match the expected `ETag`, it produces the error message *412 Precondition Failed*.
18+
The FHIR service supports create, conditional create, update, and conditional update as defined by the FHIR specification. One useful header in these scenarios is the [If-Match](https://www.hl7.org/fhir/http.html#concurrency) header. The `If-Match` header is used to validate the version being updated before making the update. If the `ETag` doesn’t match the expected `ETag`, it produces the error message *412 Precondition Failed*.
1919

2020
## Delete and conditional delete
2121

2222
The FHIR service offers two delete types. There's [Delete](https://www.hl7.org/fhir/http.html#delete), which is also know as Hard + Soft Delete, and [Conditional Delete](https://www.hl7.org/fhir/http.html#3.1.0.7.1).
2323

24-
**Delete can be performed for individual resource id or in bulk. To learn more on deleting resources in bulk, visit [$bulk-delete operation](fhir-bulk-delete.md).**
24+
**Delete can be performed for an individual resource id, or in bulk. To learn more on deleting resources in bulk, visit [$bulk-delete operation](fhir-bulk-delete.md).**
2525

2626
### Delete (hard and soft delete)
2727

28-
Delete defined by the FHIR specification requires that after deleting a resource, subsequent nonversion reads of a resource return a 410 HTTP status code. Therefore, the resource is no longer found through searching. Additionally, the FHIR service enables you to fully delete (including all history) the resource. To fully delete the resource, pass a parameter setting `hardDelete` to true `(DELETE {{FHIR_URL}}/{resource}/{id}?hardDelete=true)`. If you don't pass this parameter or set `hardDelete` to false, the historic versions of the resource are still available.
28+
Delete defined by the FHIR specification requires that after deleting a resource, subsequent nonversion reads of that resource return a 410 HTTP status code. As a result, the resource is no longer found through searching. Additionally, the FHIR service enables you to fully delete the resource (including all history). To fully delete the resource, pass a parameter `true` setting to `hardDelete`: `(DELETE {{FHIR_URL}}/{resource}/{id}?hardDelete=true)`. If you don't pass this parameter or set `hardDelete` to false, the historic versions of the resource are still available.
2929

3030
> [!NOTE]
3131
> If you only want to delete the history, the FHIR service supports a custom operation called `$purge-history`. This operation allows you to delete the history from a resource.
3232
3333
### Conditional delete
3434

35-
Conditional delete allows you to pass search criteria to delete a resource. By default, the Conditional delete allows you to delete one item at a time. You can also specify the `_count` parameter to delete up to 100 items at a time. Here are some examples of using conditional delete.
35+
Conditional delete allows you to pass search criteria to delete a resource. By default, the Conditional delete allows you to delete one item at a time. You can also specify the `_count` parameter to delete up to 100 items at a time. Following are some examples of using conditional delete.
3636

3737
To delete a single item, specify search criteria that return a single item.
3838

@@ -78,23 +78,25 @@ For example:
7878

7979
The response is a bundle with type set to the specified version history, sorted with oldest versions last, and including deleted resources.
8080

81-
To search with history, use these interactions:```
82-
* _count : defines the number of resources returned on single page.
83-
* _since : includes resource versions created at or after the given instant in time.
84-
* _before : includes resource versions that were created before the given instant in time.
81+
To search with history, use the following interactions.
8582

86-
For more information on history and version management, please visit [FHIR versioning policy and history management](fhir-versioning-policy-and-history-management.md).
83+
* `_count` : defines the number of resources returned on single page.
84+
* `_since` : includes resource versions created at or after the given instant in time.
85+
* `_before` : includes resource versions that were created before the given instant in time.
86+
87+
For more information on history and version management visit [FHIR versioning policy and history management](fhir-versioning-policy-and-history-management.md).
8788

8889
## Patch and conditional patch
8990

90-
Patch is a valuable RESTful operation when you need to update only a portion of the FHIR resource. Using patch allows you to specify the element that you want to update in the resource without having to update the entire record. FHIR defines three ways to patch resources: JSON Patch, XML Patch, and FHIRPath Patch. The FHIR service supports JSON Patch and FHIRPath Patch, along with Conditional JSON Patch and Conditional FHIRPath Patch (which allows you to patch a resource based on a search criteria instead of a resource ID). For some examples, refer to the [FHIRPath Patch REST file](https://github.com/microsoft/fhir-server/blob/main/docs/rest/FhirPatchRequests.http) and the [JSON Patch REST file](https://github.com/microsoft/fhir-server/blob/main/docs/rest/JsonPatchRequests.http). For more information, see [HL7 documentation for patch operations with FHIR](https://www.hl7.org/fhir/http.html#patch).
91+
Patch is a valuable RESTful operation when you need to update only a portion of the FHIR resource. Using patch allows you to specify the element that you want to update in the resource without having to update the entire record. FHIR defines three ways to patch resources: JSON Patch, XML Patch, and FHIRPath Patch. The FHIR service supports JSON Patch and FHIRPath Patch, along with Conditional JSON Patch and Conditional FHIRPath Patch (which allows you to patch a resource based on a search criteria instead of a resource ID).
92+
For examples, refer to the [FHIRPath Patch REST file](https://github.com/microsoft/fhir-server/blob/main/docs/rest/FhirPatchRequests.http) and the [JSON Patch REST file](https://github.com/microsoft/fhir-server/blob/main/docs/rest/JsonPatchRequests.http). For more information, see [HL7 documentation for patch operations with FHIR](https://www.hl7.org/fhir/http.html#patch).
9193

9294
> [!NOTE]
9395
> When using `PATCH` against STU3, and if you are requesting a History bundle, the patched resource's `Bundle.entry.request.method` is mapped to `PUT`. This is because STU3 doesn't contain a definition for the `PATCH` verb in the [HTTPVerb value set](http://hl7.org/fhir/STU3/valueset-http-verb.html).
9496
9597
### Patch with FHIRPath patch
9698

97-
This method of patch is the most powerful as it uses [FHIRPath](https://hl7.org/fhirpath/) for selecting which element to target. One common scenario is using FHIRPath Patch to update an element in a list without knowing the order of the list. For example, if you want to delete a patient’s home telecom information without knowing the index, you can use the example.
99+
This method of patch is the most powerful as it uses [FHIRPath](https://hl7.org/fhirpath/) for selecting which element to target. One common scenario is using FHIRPath Patch to update an element in a list without knowing the order of the list. For example, if you want to delete a patient’s home telecom information without knowing the index, you can use the following example.
98100

99101
PATCH `http://{FHIR-SERVICE-HOST-NAME}/Patient/{PatientID}`<br/>
100102
Content-type: `application/fhir+json`
@@ -124,7 +126,7 @@ Any FHIRPath Patch operations must have the `application/fhir+json` Content-Type
124126

125127
### Patch with JSON Patch
126128

127-
JSON Patch in the FHIR Service conforms to the well-used [specification defined by the Internet Engineering Task Force](https://datatracker.ietf.org/doc/html/rfc6902). The payload format doesn't use FHIR resources and instead uses a JSON document using JSON-Pointers for element selection. JSON Patch is more compact and has a test operation that allows you to validate that a condition is true before doing the patch. For example, if you want to set a patient as deceased only if they're not already marked as deceased, you can use the example.
129+
JSON Patch in the FHIR service conforms to the well-used [specification defined by the Internet Engineering Task Force](https://datatracker.ietf.org/doc/html/rfc6902). The payload format doesn't use FHIR resources and instead uses a JSON document using JSON-Pointers for element selection. JSON Patch is more compact and has a test operation that allows you to validate that a condition is true before doing the patch. For example, if you want to set a patient as deceased only if they're not already marked as deceased, you can use the following example.
128130

129131
PATCH `http://{FHIR-SERVICE-HOST-NAME}/Patient/{PatientID}`<br/>
130132
Content-type: `application/json-patch+json`
@@ -148,9 +150,9 @@ Any JSON Patch operations must have the `application/json-patch+json` Content-Ty
148150

149151
#### JSON Patch in bundles
150152

151-
By default, JSON Patch isn't supported in bundle resources because a bundle only supports with FHIR resources and the JSON Patch payload isn't a FHIR resource. To work around this constraint, use binary resources with a content type `"application/json-patch+json"` and the base64 encoding of the JSON payload inside of a bundle. For more information, see the [FHIR Chat Zulip](https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Transaction.20with.20PATCH.20request).
153+
By default, JSON Patch isn't supported in bundle resources because a bundle only supports FHIR resources, and the JSON Patch payload isn't a FHIR resource. To work around this constraint, use binary resources with a content type `"application/json-patch+json"` and the base64 encoding of the JSON payload inside of a bundle. For more information, see the [FHIR Chat Zulip](https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Transaction.20with.20PATCH.20request).
152154

153-
In the example, we change the gender for the patient to female. We take the JSON Patch `[{"op":"replace","path":"/gender","value":"female"}]` and encoded it to base64.
155+
In the following example, we change the gender for the patient to female. We take the JSON Patch `[{"op":"replace","path":"/gender","value":"female"}]` and encoded it to base64.
154156

155157
POST `https://{FHIR-SERVICE-HOST-NAME}/`<br/>
156158
Content-Type: `application/json`

0 commit comments

Comments
 (0)