Create a FHIR Resource with Conditional Create
Create a new FHIR resource in SAP Health Data Services for FHIR only if there is no equivalent resource using the conditional create request.
You can define the following request header If-None-Exist to avoid creating duplicate resources. The If-None-Exist header is set to the identifier:
If-None-Exist - identifier=system|value
When a new resource is created, SAP Health Data Services for FHIR performs a search using the request header If-None-Exist:[search parameters] and performs the action based on the count as given in the following table:
|
HTTP Code |
Scenario |
Description |
|---|---|---|
|
201 |
No matches |
Creates a new FHIR resource. |
|
200 |
One match |
Ignores the request. |
|
412 |
Multiple matches |
Request failed. |
|
404 |
No Data Found |
Authorization error. Returns 404 with no response body. |
|
422 |
Unprocessable Entity |
Validation error. Returns 422 with corresponding error message in response body. |
HTTP Request
You can use an HTTP POST request to create a FHIR resource in SAP Health Data Services for FHIR, if an equivalent resource doesn't already exist:
POST [base]/[type]
Headers
The If-None-Exist header must be set to the identifier:
If-None-Exist: identifier=system|value
Path Parameters
-
base: Service endpoint to interact with FHIR resources. For more information, see Service Endpoint.
-
Type: The type of resource, for example, Patient or Encounter.