# Get a resource graph

Canonical page: https://docs.ovok.com/primitives/resource-graph

`$graph` starts from one resource and follows the links in a `GraphDefinition`, returning the root and linked resources in a FHIR `Bundle`.

| Method | Path |
| --- | --- |
| `GET` | `/fhir/R4/:type/:id/$graph` |

## Request [#request]

The query parameter `graph` identifies a GraphDefinition by name. Its `start` type must match `:type` in the URL.

```bash
curl --get "https://api.sandbox.ovok.com/fhir/R4/Patient/${PATIENT_ID}/\$graph" \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --data-urlencode 'graph=patient-summary'
```

| Parameter | Required | Description |
| --- | --- | --- |
| `graph` | Yes | Name of a `GraphDefinition` whose `start` matches the requested resource type. |

## Successful response [#successful-response]

The operation returns a FHIR `Bundle` with `type: collection`.

| Response path | Example | Meaning |
| --- | --- | --- |
| `resourceType` | `Bundle` | Identifies the result as a FHIR Bundle. |
| `type` | `collection` | Indicates the Bundle contains the graph result. |
| `entry[].resource` | `Patient/<patient-id>`, `Observation/<observation-id>` | Root or linked FHIR resources included by the GraphDefinition. |

The example is illustrative; the actual entries depend on the GraphDefinition and linked data. An invalid graph name or mismatched start type returns an error outcome.
