Skip to main content

Connection API

Using the normal "List" search (i.e., "PatientList") is the most common way to search for resources. However, the FHIR GraphQL specification also supports the Connection API, which is a more complex way to search for resources.

The most immediate advantage of the Connection API is support for retrieving total counts. The Connection API also includes more features from FHIR Bundle such as mode and score.

To use the Connection API, append "Connection" to the resource type rather than "List". For example, use "PatientConnection" instead of "PatientList".

Here is an example of searching for a list of Patient resources using the Connection API:

{
PatientConnection {
count
edges {
resource {
resourceType
id
name { given family }
}
}
}
}
Example Response
  data: {
PatientConnection: {
count: 2,
edges: [
{
resource: {
resourceType: 'Patient',
id: 'example-patient-id-1',
name: [
{
given: ['Bart'],
family: 'Simpson',
},
],
},
},
{
resource: {
resourceType: 'Patient',
id: 'example-patient-id-2',
name: [
{
given: ['Homer'],
family: 'Simpson',
},
],
},
},
],
},
},

See the "Connection API" section of the FHIR GraphQL specification for more information.