tencent cloud

Basic Bundle Transactions

Download
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-08-28 16:06:55
AI 번역

API Description

This is used to submit one or more FHIR interaction operations via a single Bundle request. The client encapsulates multiple interaction entries within Bundle.entry and submits them to the service base address using HTTP POST. The server then processes the request according to the mode specified by Bundle.type.
In transaction mode, all entries are executed as a single atomic transaction.
In batch mode, each entry is executed independently.
The key elements of a basic transaction Bundle include:
Bundle.type: Specifies the processing mode, such as transaction or batch.
Bundle.entry: An array of interaction entries, where each entry represents an independent REST interaction.
Bundle.entry.fullUrl: The complete URL or temporary URI of an entry.
Bundle.entry.resource: The resource content of the request body.
Bundle.entry.request: The request method, request URL, and other request control information.

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
The content of the Bundle resource.
Request Body Main Field Descriptions:
Field
Type
Required
Description
resourceType
String
Yes
Fixed as Bundle.
type
String
No
Processing mode. Valid values are as follows:
transaction: The transaction mode, where all entries are executed as a single atomic transaction, and if any entry fails, the entire transaction is rolled back.
batch: The batch processing mode, where entries are executed independently without affecting each other.
When not specified, the server processes requests in transaction mode by default.
entry
Array
Yes
A list of interaction entries.
entry[].fullUrl
String
No
The unique address or placeholder URI of the entry.
entry[].resource
Object
No
The resource content, applicable to operations such as create, update, delete, and patch.
entry[].request.method
String
Yes
The request method for the entry, such as POST, PUT, DELETE, and PATCH.
entry[].request.url
String
Yes
The target resource path for the entry.

Output Parameters

Upon a successful API call, the HTTP status code 200 OK or 201 Created is typically returned. The response headers contain the content type and request trace information, and the response body is usually a Bundle resource that describes the execution result of each entry.
Response Header Example Description:
Parameter Name
Type
Description
Status Code
Integer
Returns 200 OK or 201 Created 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
Processing results of each entry.
entry[].response.status
String
The processing status of the entry, such as 201 Created.
entry[].response.location
String
Resource location or version address.
entry[].response.etag
String
Resource version identifier.
entry[].response.lastModified
String
Last modification time of the resource.
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": [
{
"fullUrl": "urn:uuid:850bc2ca-d9ab-467b-9924-0e08d0a6e586",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"system": "https://example.org/mrns",
"value": "8ffd03ee-fb56-441d-a3ef-01cdc9f94d89"
}
],
"name": [
{
"use": "official",
"family": "Trantow673",
"given": [
"Matthew562"
],
"prefix": [
"Mr."
]
}
],
"gender": "male"
},
"request": {
"method": "POST",
"url": "Patient"
}
}
]
}

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": "201 Created",
"location": "Patient/<RESOURCE_ID>/_history/1",
"etag": "1",
"lastModified": "2026-07-09T18:50:33.309+08:00",
"outcome": {
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "information",
"code": "informational",
"details": {
"coding": [
{
"system": "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code",
"code": "SUCCESSFUL_CREATE",
"display": "Create succeeded."
}
]
},
"diagnostics": "Successfully created resource \\"Patient/<RESOURCE_ID>/_history/1\\". Took 68ms."
}
]
}
}
}
]
}

Error Codes

Common error codes are listed below. For more error codes, see Error Codes.
Error Code
Description
400 Bad Request
The Bundle structure is incorrect, or the entry request format is invalid.
401 Unauthorized
Not authenticated, and valid credentials are missing.
403 Forbidden
Authenticated but not authorized to perform Bundle operations.
404 Not Found
The target resource path in the entry does not exist.
422 Unprocessable Entity
The Bundle syntax is correct, but it fails business or rule validation.
500 Internal Server Error
Internal server processing exception.


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백