tencent cloud

Creating

Download
フォーカスモード
フォントサイズ
最終更新日: 2026-08-28 16:06:55
AI翻訳

API Description

This is used to create new resource instances in the FHIR data service. This API follows the standard FHIR Create operation. The client submits FHIR-compliant resource content to the specified resource type endpoint via the HTTP POST method. After the server persists the resource, it returns the newly created resource along with its metadata.
This example demonstrates how to call the API to create a Patient resource.

Input parameters

Parameter Name
Type
Required
Description
HTTP Method
String
Yes
Fixed to POST
URL
String
Yes
The address for creating resources, in the format [baseUrl]/[resourceType].
Authorization
String
Yes
The authentication token, in the format Bearer <AccessToken>. The AccessToken is obtained via the GetAccessToken API in Calling Methods (in the instance console scenario, it can be obtained via the GetWebAccessToken API).
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 FHIR resource to be created must comply with the FHIR structure definition of the corresponding resource type.
Request URL Example:
https://HOSTNAME/INSTANCE_ID/fhir/Patient
Request Body Example Field Descriptions:
Field
Type
Required
Description
resourceType
String
Yes
The FHIR resource type. In this example, it is Patient. 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.
identifier
Array
No
Patient identification information
identifier[].system
String
No
The identification system, for example, urn:oid:1.2.36.146.595.217.0.1.
identifier[].value
String
No
The identifier value, for example, 12345.
name
Array
No
Name information
name[].family
String
No
Family name
name[].given
Array
No
Given name
gender
String
No
Gender. The valid values are male (male), female (female), other (other), and unknown (unknown). For details, see FHIR Patient.gender.
birthDate
String
No
Date of birth. The format is YYYY-MM-DD.

Output Parameters

Upon a successful API call, the HTTP status code 201 Created is returned. The response headers contain the location and version information of the newly created resource, and the response body returns the complete content of the created resource. Some instances may be configured not to return a response body upon creation. In this case, you can call the Read API using the Location address in the response headers to obtain the complete resource content.
Response Header Example Description:
Parameter Name
Type
Description
Status Code
Integer
Returns 201 Created when successful.
ETag
String
Resource version identifier, for example W/"1".
Location
String
Address for the newly created resource and its historical versions
Content-Location
String
The address of the current resource version, in the format [baseUrl]/[resourceType]/[id]/_history/[versionId].
x-request-id
String
Request trace ID
Key Response Body Field Descriptions:
Field
Type
Description
resourceType
String
Resource Type
id
String
Unique ID of the newly created resource
meta.versionId
String
Version ID of the current resource
meta.lastUpdated
String
Last update time of the resource
meta.source
String
The source identifier of the resource, in the format of #<hash value>, is used to identify the system from which the resource was created. For more information, see FHIR Meta.source.
meta.profile
Array
List of FHIR StructureDefinition profiles that the resource conforms to
identifier
Array
Resource identification information
name
Array
Name information of the resource
gender
String
Gender
birthDate
String
Date of birth
Note:
text is the Narrative (human-readable summary) field of a FHIR resource and contains two sub-fields: status and div. By default, the server does not automatically generate a Narrative, and the response body typically does not include the text field. The server retains and returns the text field only when the client actively provides it in the request body. The valid values for text.status are generated (system-generated), extensions (containing only extension information), and additional (containing additional content). For details, see FHIR NarrativeStatus.

Examples

Request Example

POST /INSTANCE_ID/fhir/Patient HTTP/1.1
Host: HOSTNAME
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/fhir+json
{
"resourceType": "Patient",
"identifier": [
{
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345"
}
],
"name": [
{
"family": "Chalmers",
"given": [
"Peter",
"James"
]
}
],
"gender": "male",
"birthDate": "1974-12-25"
}

Response Example

HTTP/1.1 201 Created
ETag: W/"1"
Location: https://HOSTNAME/INSTANCE_ID/fhir/Patient/199963/_history/1
Content-Location: https://HOSTNAME/INSTANCE_ID/fhir/Patient/199963/_history/1
x-request-id: ENqsVXqc5SeqLOfU
{
"resourceType": "Patient",
"id": "199963",
"meta": {
"versionId": "1",
"lastUpdated": "2022-10-10T07:07:33.086-04:00",
"source": "#oYcdS7hlfUBnsSlX",
"profile": [
"http://hl7.org/fhir/StructureDefinition/Patient"
]
},
"identifier": [
{
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345"
}
],
"name": [
{
"family": "Chalmers",
"given": [
"Peter",
"James"
]
}
],
"gender": "male",
"birthDate": "1974-12-25"
}

Error Codes

Common error codes are listed below. For more error codes, see Error Codes.
Error Code
Description
400 Bad Request
The request parameters are incorrect, or the submitted resource content does not conform to the JSON/FHIR structure requirements.
401 Unauthorized
Not authenticated, and valid credentials are missing.
403 Forbidden
Authenticated but not authorized to create the resource.
404 Not Found
The endpoint for the target resource type does not exist.
415 Unsupported Media Type
The Content-Type is not supported, for example, application/fhir+json is not used.
422 Unprocessable Entity
The resource content passes syntax validation but fails business or FHIR rule validation.
500 Internal Server Error
Internal server processing exception.


ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック