Delete operation, where the client sends a request to the specified resource address using the HTTP DELETE method. The delete operation is typically a logical deletion. This means the resource is marked as deleted and will not appear in regular search results, but its historical versions are retained.Parameter Name | Type | Required | Description |
HTTP Method | String | Yes | Fixed as DELETE. |
URL | String | Yes | The address for deleting resources, in the format [baseUrl]/[resourceType]/[id]. |
Authorization | String | Yes | The authentication token, in the format Bearer <AccessToken>. The AccessToken is obtained via the GetAccessToken API in Calling Methods (or via the GetWebAccessToken API in the instance console scenario). |
Field | Type | Required | Description |
resourceType | String | Yes | The FHIR resource type, such as Patient, Observation, MedicationRequest, and so on. To view all resource types actually supported by the current instance, call the CapabilityStatement API via GET /INSTANCE_ID/fhir/metadata and check the returned rest[].resource[].type (the resource types supported by an instance can be configured and trimmed during creation via supported_resource_types, which may vary across instances). For field definitions of each resource type, refer to FHIR Resource Types. |
id | String | Yes | The unique ID of the resource to be deleted. It is the logical ID automatically assigned by the server when the resource is created, and can be obtained in the following ways: Call the Create API (POST) to create a resource. Obtain the resource identifier from the Content-Location response header or the id field in the response body.Call the Search API (GET /[resourceType]?_id= or /[resourceType]?identifier=) to query for existing resource IDs. |
https://HOSTNAME/INSTANCE_ID/fhir/Patient/199963
200 OK is typically returned, with the latest version information included in the response headers. The response body is usually an OperationOutcome resource, which describes the result of the deletion operation.Parameter Name | Type | Description |
Status Code | Integer | Returns 200 OK when successful. |
Content-Location | String | The address of the historical version corresponding to the deleted resource, in the format [baseUrl]/[resourceType]/[id]/_history/[versionId]. |
Field | Type | Description |
resourceType | String | Returns the resource type, usually OperationOutcome. |
issue | Array | Execution result details. |
issue[].severity | String | The severity level, for example, information. |
issue[].code | String | The result code, for example, informational. |
issue[].diagnostics | String | A description of the deletion result, for example, Successfully deleted 1 resource(s). Took 17ms.. |
issue[].details | Object | Structured details (of type CodeableConcept) that contain subfields such as coding to express machine-readable error information. |
DELETE /INSTANCE_ID/fhir/Patient/199963 HTTP/1.1Host: HOSTNAMEAuthorization: Bearer YOUR_JWT_TOKEN
HTTP/1.1 200 OKContent-Location: https://HOSTNAME/INSTANCE_ID/fhir/Patient/199963/_history/3
{"resourceType": "OperationOutcome","issue": [{"severity": "information","code": "informational","details": {"coding": [{"system": "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code","code": "SUCCESSFUL_DELETE","display": "Delete succeeded."}]},"diagnostics": "Successfully deleted 1 resource(s). Took 17ms."}]}
Error Code | Description |
400 Bad Request | Incorrect request format or invalid resource ID. |
401 Unauthorized | Not authenticated, and valid credentials are missing. |
403 Forbidden | Authenticated but not authorized to delete the resource. |
404 Not Found | The specified resource does not exist. |
409 Conflict | The current resource state does not allow deletion (for example, a version conflict prevents deletion). |
410 Gone | The resource has been logically deleted or is inaccessible. |
422 Unprocessable Entity | The resource violates business rules or FHIR specifications and cannot be deleted. |
500 Internal Server Error | Internal server processing exception. |
文档反馈