I'm trying to import a Bundle of Patient resources to a FHIR server using cURL. Here's my command and the response:
curl --header "Content-Type:application/json" -X POST -k -i -u 'fhiruser:change-password' --data @10patients.json 'https://localhost:9443/fhir-server/api/v4/Bundle'
HTTP/2 201
location: https://localhost:9443/fhir-server/api/v4/Bundle/17621baad7c-6fdc1153-38d8-4987-9be3-0d4f0983dbac/_history/1
etag: W/"1"
last-modified: Wed, 02 Dec 2020 04:34:10 GMT
date: Wed, 02 Dec 2020 04:34:10 GMT
content-length: 0
content-language: en-US
It appears to have worked. If I GET the bundle itself I can do that; but if I try to access any of the individual Patient resources by id or to get all the Patient resources, I get nothing. It seems they're accessible only as a part of the Bundle. For instance:
curl -i -s -k -u 'fhiruser:change-password' -X GET 'https://localhost:9443/fhir-server/api/v4/Patient'
or
curl -i -s -k -u 'fhiruser:change-password' -X GET 'https://localhost:9443/fhir-server/api/v4/Patient/17621b90c2f-492f5677-f480-4ef8-8b6a-4a2ebfbad715'
return nothing.
Here's the beginning of the data file containing the patient resources:
{
"resourceType": "Bundle",
"id": "b248b1b2-1686-4b94-9936-37d7a5f94b51",
"meta": {
"lastUpdated": "2012-05-29T23:45:32Z"
},
"type": "batch",
"entry": [
{
"fullUrl": "http://hl7.org/fhir/Patient/1",
"resource": {
"resourceType": "Patient",
"id": "1",
"meta": {
"lastUpdated": "2012-05-29T23:45:32Z"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Everywoman, Eve. SSN:\n 444222222</div>"
},
"identifier": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS"
}
]
},
"system": "http://hl7.org/fhir/sid/us-ssn",
"value": "444222222"
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Everywoman",
"given": [
"Eve"
]
}
],
"telecom": [
{
"system": "phone",
"value": "555-555-2003",
"use": "work"
}
],
"gender": "female",
"birthDate": "1973-05-31",
"address": [
{
"use": "home",
"line": [
"2222 Home Street"
]
}
],
"managingOrganization": {
"reference": "Organization/hl7"
}
},
"request": {
"method": "POST",
"url": "Patient"
}
},
{
"fullUrl": "http://hl7.org/fhir/Patient/2",
"resource": {
"resourceType": "Patient",
"id": "2",
"meta": {
"lastUpdated": "2012-05-29T23:45:32Z"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Everyman, Adam. SSN:\n 444333333</div>"
},
"identifier": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS"
}
]
},
"system": "http://hl7.org/fhir/sid/us-ssn",
"value": "444333333"
}
],
"active": true,
"name": [
{
"use": "official",
...
As you can see I used "type": "batch" in the data file. I also tried "type": "transaction" but that had the same results. Obviously I can import the patients on at a time using a shell script but I'd prefer to import the whole bundle at once.
According the standard, when you post the bundle to [base]/Bundle, you are asking the server to store the batch / transaction like any other Bundle. when you post it to [base] then it will be processed