tencent cloud

Deleting Within a Transaction

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

API Description

This is used to perform a delete operation within a transaction Bundle. In a single transaction request, the client can submit multiple delete entries for unified processing by the server. In transaction mode, delete operations are executed as a whole. If any one of the delete entries fails, the entire transaction rolls back, and the other deletions do not take effect.

Input parameters

Parameter Name
Type
Required
Description
HTTP Method
String
Yes
Fixed to POST.
URL
String
Yes
The Bundle submission URL, usually [baseUrl].
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).
Content-Type
String
No
The MIME type of the request body. For write-type requests, it is typically application/fhir+json; if not specified, the server will automatically infer it based on the request content.
Request Body
JSON Object
Yes
A transaction Bundle containing deletion entries.
Request Body Main Field Descriptions:
Field
Type
Required
Description
resourceType
String
Yes
Fixed as Bundle.
type
String
No
Processing mode. Valid values are transaction (transaction mode, where all entries are executed as an atomic transaction, and the entire operation is rolled back if any entry fails) or batch (batch mode, where each entry is executed independently without affecting others). If not specified, it defaults to transaction.
entry
Array
Yes
A list of deletion entries.
entry[].request.method
String
Yes
Fixed as DELETE.
entry[].request.url
String
Yes
The path of the resource to be deleted, in the format [resourceType]/[id], for example, Patient/A0.

Output Parameters

Upon a successful API call, the HTTP status code 200 OK is returned. The response headers contain the content type and request trace information, and the response body is a result Bundle of type transaction-response, which includes the execution status of each delete entry. Note that the response status code for each individual delete entry is 204 No Content, not the 200 OK of the overall response.
Response Header Example Description:
Parameter Name
Type
Description
Status Code
Integer
Returns 200 OK when successful.
Location
String
The URL of the Bundle response resource, in the format [baseUrl]/Bundle/[bundleId].
Content-Location
String
The URL of the current version of the Bundle response resource.
Content-Type
String
The MIME type of the response body, typically application/fhir+json.
x-request-id
String
Request trace ID.
Key Response Body Field Descriptions:
Field
Type
Description
resourceType
String
Returns the resource type, usually Bundle.
id
String
Unique identifier of the Bundle resource.
type
String
The type of the response Bundle. It returns transaction-response in transaction mode and batch-response in batch mode.
link
Array
A list of link information, containing navigation links related to the current Bundle.
link[].relation
String
The type of link relation, such as self (pointing to the current request address).
link[].url
String
Link address.
entry
Array
Execution results of the deletion entries.
entry[].response.status
String
The execution status of the deletion. It is 204 No Content when successful.
entry[].response.location
String
Location of the resource version after deletion.
entry[].response.etag
String
Resource version identifier.
entry[].response.outcome
Object
Details of the operation outcome, containing the OperationOutcome resource, which describes the specific result information of the entry execution.

Examples

Request Example

POST /INSTANCE_ID/fhir HTTP/1.1
Host: HOSTNAME
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/fhir+json
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "DELETE",
"url": "Patient/A0"
}
},
{
"request": {
"method": "DELETE",
"url": "Patient/A1"
}
}
]
}

Response Example

HTTP/1.1 200 OK
Location: https://HOSTNAME/INSTANCE_ID/fhir/Bundle/<BUNDLE_ID>
Content-Location: https://HOSTNAME/INSTANCE_ID/fhir/Bundle/<BUNDLE_ID>
Content-Type: application/fhir+json
x-request-id: <REQUEST_ID>
{
"resourceType": "Bundle",
"id": "<BUNDLE_ID>",
"type": "transaction-response",
"link": [
{
"relation": "self",
"url": "https://HOSTNAME/INSTANCE_ID/fhir"
}
],
"entry": [
{
"response": {
"status": "204 No Content",
"location": "Patient/A0/_history/2",
"etag": "2",
"outcome": {
"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 87ms."
}
]
}
}
},
{
"response": {
"status": "204 No Content",
"location": "Patient/A1/_history/2",
"etag": "2",
"outcome": {
"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 87ms."
}
]
}
}
}
]
}

Error Codes

Common error codes are listed below. For more error codes, see Error Codes.
Error Code
Description
400 Bad Request
The deletion entry is malformed, or the resource path is invalid.
401 Unauthorized
Not authenticated, and valid credentials are missing.
403 Forbidden
Authenticated but not authorized to perform the delete operation.
404 Not Found
The target resource in the entry does not exist.
409 Conflict
A deletion entry failure caused a transaction rollback.
500 Internal Server Error
Internal server processing exception.


帮助和支持

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

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

文档反馈