Resource Relationships

Getting the most out of the NexHealth API requires understanding how different resources relate to each other and how you can access these relationships.

Answering questions like "What procedures were performed in a given appointment?" or "What payments has a patient made?" is only possible when you understand how to query the relationships between resources. In the NexHealth API this can be accomplished two different ways, the include parameter, and filtering.

The Include Parameter

To answer our first question, "What procedures were performed in a given appointment?" you can use the include parameter. By adding "include[]=procedures" as a query parameter on a request to appointments you can view a list of appointments with the procedures that were performed during them. You can see the example cURL command below.

Make sure to switch out your subdomain, location ID, and bearer token.

curl --request GET \
     --url 'https://sandbox.nexhealth.com/appointments?subdomain=YOUR_SUBDOMAIN&location_id=YOUR_LOCATION_ID&start=2022-01-01&end=2022-12-31&include\[\]=procedures&page=1&per_page=5' \
     --header 'Accept: application/vnd.Nexhealth+json;version=2' \
     --header 'Authorization: YOUR_BEARER_TOKEN

Filtering

To answer our second question, "What payments has this patient made?" you can use filtering. By making a request to our payments endpoint and adding "patient_id=YOUR_PATIENT_ID" as a query param we can see all the payments that were made by a given patient. You can see an example cURL command below.

Make sure to switch out your subdomain, location ID, bearer token, and the patient ID you'd like to filter for.

curl --request GET \
     --url 'https://sandbox.nexhealth.com/payments?subdomain=YOUR_SUBDOMAIN%20&location_id=YOUR_LOCATION_ID&patient_id=YOUR_PATIENT_ID&page=1&per_page=5' \
     --header 'Accept: application/vnd.Nexhealth+json;version=2' \
     --header 'Authorization: YOUR_BEARER_TOKEN'