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.Patient resource.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. |
https://HOSTNAME/INSTANCE_ID/fhir/Patient
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. |
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.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 |
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 |
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.POST /INSTANCE_ID/fhir/Patient HTTP/1.1Host: HOSTNAMEAuthorization: Bearer YOUR_ACCESS_TOKENContent-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"}
HTTP/1.1 201 CreatedETag: W/"1"Location: https://HOSTNAME/INSTANCE_ID/fhir/Patient/199963/_history/1Content-Location: https://HOSTNAME/INSTANCE_ID/fhir/Patient/199963/_history/1x-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 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. |
피드백