Aidbox Docs

$dump

You can dump all resources of a specified type. Aidbox will respond with Chunked Transfer Encoding ndjson stream, optionally you can get the output in FHIR format or GZIPped.

This is a memory-efficient operation. Aidbox just streams the database cursor to a socket. If your HTTP Client supports processing of Chunked Encoding, you can process resources in stream one by one without waiting for the end of the response.

$dump is an Aidbox-only endpoint. It is available at /<ResourceType>/$dump and is not available at /fhir/<ResourceType>/$dump. Requests to the /fhir/ prefixed path will return a 404 error.

GET [base]/<resourceType>/$dump
GET /Patient/$dump
HTTP/1.1 200 OK
Content-Type: application/ndjson
Transfer-Encoding: chunked

{"resourceType": "Patient", "id": .............}
{"resourceType": "Patient", "id": .............}
{"resourceType": "Patient", "id": .............}
{"resourceType": "Patient", "id": .............}
.........

Path Parameters

ParameterRequired?TypeDescription
resourceTypetrueStringname of the resource type to be exported

Query Parameters

ParameterRequired?TypeDescription
_sincefalseStringDate in ISO format; if present, exported data will contain only the resources created after the date.
fhirfalseBooleanConvert data to the FHIR format. If disabled, the data is exported in the Aidbox format.
gzipoptionalBooleanGZIP the result. If enabled, HTTP headers for gzip encoding are also set.

Examples

Here is an example of how you can dump all patients from your box (assuming you have a client with an access policy):

Curl

curl -u bulk-client:secret $AIDBOX_BASE_URL/Patient/\$dump

REST Console

GET /Patient/$dump

Status

200 OK

Headers

HeaderValue
Content-Typeapplication/ndjson
Transfer-Encodingchunked

Body

{"id": "pt-1", "meta": {"createdAt": "2021-06-10T08:26:10.707454Z", "versionId": "481", "lastUpdated": "2021-06-10T08:26:10.707454Z"}, "name": [{"given": ["Alice"]}], "resourceType": "Patient"}
{"id": "pt-2", "meta": {"createdAt": "2021-06-10T08:26:10.707454Z", "versionId": "482", "lastUpdated": "2021-06-10T08:26:10.707454Z"}, "name": [{"given": ["Bob"]}], "resourceType": "Patient"}
{"id": "pt-3", "meta": {"createdAt": "2021-06-10T08:26:10.707454Z", "versionId": "483", "lastUpdated": "2021-06-10T08:26:10.707454Z"}, "name": [{"given": ["Charles"]}], "citizenship": [{"code": {"text": "ru"}}], "resourceType": "Patient"}

Body (manually formatted)

{
  "id": "pt-1",
  "meta": {
    "createdAt": "2021-06-10T08:26:10.707454Z",
    "versionId": "481",
    "lastUpdated": "2021-06-10T08:26:10.707454Z"
  },
  "name": [
    {
      "given": [
        "Alice"
      ]
    }
  ],
  "resourceType": "Patient"
}
{
  "id": "pt-2",
  "meta": {
    "createdAt": "2021-06-10T08:26:10.707454Z",
    "versionId": "482",
    "lastUpdated": "2021-06-10T08:26:10.707454Z"
  },
  "name": [
    {
      "given": [
        "Bob"
      ]
    }
  ],
  "resourceType": "Patient"
}
{
  "id": "pt-3",
  "meta": {
    "createdAt": "2021-06-10T08:26:10.707454Z",
    "versionId": "483",
    "lastUpdated": "2021-06-10T08:26:10.707454Z"
  },
  "name": [
    {
      "given": [
        "Charles"
      ]
    }
  ],
  "citizenship": [
    {
      "code": {
        "text": "ru"
      }
    }
  ],
  "resourceType": "Patient"
}

Dump appointments

REST Console

GET /Appointment/$dump

Curl

curl -u bulk-client:secret $AIDBOX_BASE_URL/Appointment/\$dump

Status

200 OK

Headers

HeaderValue
Content-Typeapplication/ndjson
Transfer-EncodingChunked

Body

{"id": "ap-1", "meta": {"createdAt": "2021-06-10T08:26:10.707454Z", "versionId": "484", "lastUpdated": "2021-06-10T08:26:10.707454Z"}, "status": "fulfilled", "participant": [{"actor": {"id": "pt-1", "resourceType": "Patient"}, "status": "accepted"}], "resourceType": "Appointment"}
{"id": "ap-2", "meta": {"createdAt": "2021-06-10T08:26:10.707454Z", "versionId": "485", "lastUpdated": "2021-06-10T08:26:10.707454Z"}, "status": "booked", "participant": [{"actor": {"id": "pt-1", "resourceType": "Patient"}, "status": "accepted"}], "resourceType": "Appointment"}
{"id": "ap-3", "meta": {"createdAt": "2021-06-10T08:26:10.707454Z", "versionId": "486", "lastUpdated": "2021-06-10T08:26:10.707454Z"}, "status": "fulfilled", "participant": [{"actor": {"id": "pt-2", "resourceType": "Patient"}, "status": "accepted"}], "resourceType": "Appointment"}

Body (manually formatted)

{
  "id": "ap-1",
  "meta": {
    "createdAt": "2021-06-10T08:26:10.707454Z",
    "versionId": "484",
    "lastUpdated": "2021-06-10T08:26:10.707454Z"
  },
  "status": "fulfilled",
  "participant": [
    {
      "actor": {
        "id": "pt-1",
        "resourceType": "Patient"
      },
      "status": "accepted"
    }
  ],
  "resourceType": "Appointment"
}
{
  "id": "ap-2",
  "meta": {
    "createdAt": "2021-06-10T08:26:10.707454Z",
    "versionId": "485",
    "lastUpdated": "2021-06-10T08:26:10.707454Z"
  },
  "status": "booked",
  "participant": [
    {
      "actor": {
        "id": "pt-1",
        "resourceType": "Patient"
      },
      "status": "accepted"
    }
  ],
  "resourceType": "Appointment"
}
{
  "id": "ap-3",
  "meta": {
    "createdAt": "2021-06-10T08:26:10.707454Z",
    "versionId": "486",
    "lastUpdated": "2021-06-10T08:26:10.707454Z"
  },
  "status": "fulfilled",
  "participant": [
    {
      "actor": {
        "id": "pt-2",
        "resourceType": "Patient"
      },
      "status": "accepted"
    }
  ],
  "resourceType": "Appointment"
}

Dump patients in FHIR format

REST Console

GET /Patient/$dump?fhir=true

Curl

curl -u bulk-client:secret $AIDBOX_BASE_URL/Patient/\$dump?fhir=true

Status

200 OK

Headers

HeaderValue
Content-Typeapplication/ndjson
Transfer-Encodingchunked

Body

{"id":"pt-1","meta":{"versionId":"481","lastUpdated":"2021-06-10T08:26:10.707454Z","extension":[{"url":"ex:createdAt","valueInstant":"2021-06-10T08:26:10.707454Z"}]},"name":[{"given":["Alice"]}],"resourceType":"Patient"}
{"id":"pt-2","meta":{"versionId":"482","lastUpdated":"2021-06-10T08:26:10.707454Z","extension":[{"url":"ex:createdAt","valueInstant":"2021-06-10T08:26:10.707454Z"}]},"name":[{"given":["Bob"]}],"resourceType":"Patient"}
{"id":"pt-3","meta":{"versionId":"483","lastUpdated":"2021-06-10T08:26:10.707454Z","extension":[{"url":"ex:createdAt","valueInstant":"2021-06-10T08:26:10.707454Z"}]},"name":[{"given":["Charles"]}],"citizenship":[{"code":{"text":"ru"}}],"resourceType":"Patient"}

Body (manually formatted)

{
  "id": "pt-1",
  "meta": {
    "versionId": "481",
    "lastUpdated": "2021-06-10T08:26:10.707454Z",
    "extension": [
      {
        "url": "ex:createdAt",
        "valueInstant": "2021-06-10T08:26:10.707454Z"
      }
    ]
  },
  "name": [
    {
      "given": [
        "Alice"
      ]
    }
  ],
  "resourceType": "Patient"
}
{
  "id": "pt-2",
  "meta": {
    "versionId": "482",
    "lastUpdated": "2021-06-10T08:26:10.707454Z",
    "extension": [
      {
        "url": "ex:createdAt",
        "valueInstant": "2021-06-10T08:26:10.707454Z"
      }
    ]
  },
  "name": [
    {
      "given": [
        "Bob"
      ]
    }
  ],
  "resourceType": "Patient"
}
{
  "id": "pt-3",
  "meta": {
    "versionId": "483",
    "lastUpdated": "2021-06-10T08:26:10.707454Z",
    "extension": [
      {
        "url": "ex:createdAt",
        "valueInstant": "2021-06-10T08:26:10.707454Z"
      }
    ]
  },
  "name": [
    {
      "given": [
        "Charles"
      ]
    }
  ],
  "citizenship": [
    {
      "code": {
        "text": "ru"
      }
    }
  ],
  "resourceType": "Patient"
}

Last updated: