Batch create
Create multiple Patient and/or ServiceRequest resources in one request using FHIR Batch operation. The batch operation supports linking resources together using temporary "urn:uuid" identifiers.
For example, this request will create a Patient and ServiceRequest, even though the Patient ID is not known in advance:
curl -X POST https://api.kit.com/fhir/R4/ \
-H "Authorization: Bearer $MY_ACCESS_TOKEN" \
-H "Content-Type: application/fhir+json" \
-d '{
"resourceType":"Bundle",
"type":"transaction",
"entry":[
{
"fullUrl":"urn:uuid:d39201d1-ee77-4caa-8941-64b71cd9440a",
"request":{
"method":"POST",
"url":"Patient"
},
"resource":{
"resourceType":"Patient",
"id":"d39201d1-ee77-4caa-8941-64b71cd9440a",
"name":[{"given":["Example"],"family":"Example"}],
"birthDate":"1990-01-01",
"address":[{
"line":["534 Erewhon St"],
"city": "PleasantVille",
"state": "Vic",
"postalCode": "3999"
}]
}
},
{
"fullUrl":"urn:uuid:857d3c73-9825-4006-9270-91d97c563bea",
"request":{
"method":"POST",
"url":"ServiceRequest"
},
"resource":{
"resourceType":"ServiceRequest",
"id":"857d3c73-9825-4006-9270-91d97c563bea",
"subject":{
"reference":"urn:uuid:d39201d1-ee77-4caa-8941-64b71cd9440a",
"display":"Test Patient"
},
"code":{
"coding":[{
"system":"https://kit.com/tests",
"code":"LIPID"
}]
}
}
}
]
}
'
For more information about FHIR batch: https://www.hl7.org/fhir/http.html#transaction