Create Data
You can use a POST request to create a FHIR® resource on the 1up FHIR Server using an access token or client credential headers. You can create a single resource or multiple resources.
When a FHIR resource is posted to the 1up FHIR Server, a corresponding Provenance FHIR resource is created automatically that references the newly created resource. 1up automatically performs base R4 specification validation when FHIR resources are posted to the FHIR Server.
Create a Single Resource
You can create one FHIR resource at a time using either an access token or a client credential header.
POST https://api.1up.health/{fhirVersion}/{resourceType}
Use to create a FHIR resource of a specified type.
Parameters
Header | ||
---|---|---|
Authorization | string | This endpoint receives authentication requests as an HTTP authentication header with a Bearer token. |
Responses
200 |
POST https://api.1up.health/{fhirVersion}/{resourceType}
Use to create a FHIR resource of a specified type.
Parameters
Header | ||
---|---|---|
client_id | string | Your 1up OAuth 2.0 application client ID. |
client_secret |
string |
Your 1up OAuth 2.0 application client secret. |
x-oneup-user-id |
string |
Your 1up user ID. The resource is stored under this ID. |
Responses
200 | |
400: Bad Request |
|
401: Unauthorized |
Create Multiple FHIR Resources with a Bundle
You can also POST
to [baseUrl]/[fhirVersion]
(such as /r4) to submit a bundle of up to 20 FHIR resources at the same time. Each individual FHIR resource in the bundle is posted independently and each is validated. If you POST a bundle of 10 resources, and nine pass validation, and one has validation errors, the nine valid resources are added to the FHIR Server, and the invalid resource is not.
You can POST the bundle using either OAuth 2.0 Access Token or client credential headers.
When you POST resources with a transaction bundle, the FHIR server assigns IDs to the resources in the entry
payload. You can either specify those IDs, the FHIR server can randomly assign them, or the FHIR server can randomly assign them and resolve references between resources.
If you want to specify the IDs, include them as valid FHIR identifiers in each fullUrl
or resource id
.
If you want to allow the FHIR server to randomly assign IDs to the resources, you can exclude the fullUrl
and resource id
fields.
If you want the FHIR server to randomly assign IDs to the resources and resolve any underlying references between resources, you can use urn
identifiers as placeholder IDs. The FHIR server assigns a placeholder ID to the resource as a UUID and assigns that temporary placeholder ID in any other bundle resources that reference that placeholder ID. This placeholder ID temporarily links the resources in the bundle until the FHIR server can determine the correct resource ID. After the FHIR server identifies the actual resource ID, the FHIR server replaces the temporary placeholder ID with the actual resource ID in all of the affected resources.
For more information about FHIR Bundles and placeholder IDs, see Resource URL & Uniqueness Rules in a Bundle and Resolving References in Bundles in the HL7 FHIR R4 documentation.
This example includes placeholder IDs for the resources in a transaction bundle.
curl --location --request POST 'https://{baseUrl}/{fhirVersion}/' \
--header 'Authorization: Bearer {accessToken}' \
--data-raw '{
"resourceType": "Bundle",
"type": "transaction",
"entry": [ {
"fullUrl": "urn:uuid:e16eac01-a5ee-4904-b1c8-f4bd56e338d5",
"resource": {
"resourceType": "Patient",
...
},
"request": {
"method": "POST",
"url": "Patient"
}
}, {
"fullUrl": "urn:uuid:499733fe-7ced-4d15-81ce-8a433a1fb71e",
"resource": {
"resourceType": "Observation",
"subject": {
"reference": "urn:uuid:e16eac01-a5ee-4904-b1c8-f4bd56e338d5"
},
...
},
"request": {
"method": "POST",
"url": "Observation"
}
} ]
}