tencent cloud

Delete

Download
聚焦模式
字号
最后更新时间: 2026-08-28 16:06:55
本文档由 AI 翻译

API Description

This function deletes the resource instance corresponding to a specified resource ID. This API follows the standard FHIR 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.
Logical deletion is typically assigned the following semantics:
The resource is marked as deleted and no longer appears in search results.
The resource version number is incremented, and a new deletion version is generated.
Historical versions are typically not physically deleted.
A resource can be reactivated later via an update, provided that business rules are satisfied.

Input parameters

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).
Path Parameter Description:
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.
Request URL Example:
https://HOSTNAME/INSTANCE_ID/fhir/Patient/199963

Output Parameters

Upon a successful API call, the HTTP status code 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.
Response Header Example Description:
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].
Key Response Body Field Descriptions:
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.

Examples

Example Requests

DELETE /INSTANCE_ID/fhir/Patient/199963 HTTP/1.1
Host: HOSTNAME
Authorization: Bearer YOUR_JWT_TOKEN

Response Example

HTTP/1.1 200 OK
Content-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 Codes

Common error codes are listed below. For more error codes, see Error Codes.
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.


帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈