Filtering, sorting & pagination
Filtering
When making requests to some of Capable Health's API endpoints, you may add filter criteria. We currently support filtering on the following endpoints:
Model | Endpoint | Filters |
---|---|---|
/care_plans/templates | by_name, by_tags, by_external_id | |
/goals/templates | by_name, by_tags, by_external_id | |
/tasks/templates | by_name, by_tags, by_external_id | |
/care_plans | by_name, by_tags | |
/goals | by_name, by_tags | |
/tasks | by_name, by_tags |
Filters are applied using a query string. For example:
/care_plans/templates?by_external_id=id
/goals/templates?by_name=name
/tasks/templates?by_tags=tags1,tags2,tags3
Note that with tags, we try and find any entity that has an associated tag. This will be treated as a logical OR
. In the above example, tasks returned from the filter would have any of the indicated tags: tags1
, tags2
, or tags3
.
For more information on tagging, see the Tagging section of Core concepts.
Query string chaining can be used with filtering and will act as a logical AND
. For example, /care_plans/templates?by_external_id=12345&by_name=Sleep+Well
.
The above query string will find care plan templates with an external ID of "12345" and the name "Sleep Well".
Sorting
When making requests to some of Capable Health's API endpoints, you may request the data to be sorted. You can sort the data by created_at
and updated_at
using sort_by
. A -
will sort the data in desc
order.
created_at
-created_at
updated_at
-updated_at
We currently support sorting on the following endpoints:
Model | endpoint |
---|---|
Care Plan Templates | /care_plans/templates |
Care Plans | /care_plans |
Goal Templates | /goals/templates |
Goals | /goals |
Leads | /leads |
Medication Orders | /medication_orders |
Observation Types | /observation_types |
Patients | /patients |
Patient Medications | /patient_medications |
Patient Related Persons | /patient_related_persons |
Practitioners | /practitioners |
Products | /products |
Questionnaires | /questionnaires |
Submissions | /submissions |
Target Templates | /targets/templates |
Targets | /targets |
Task Templates | /tasks/templates |
Tasks | /tasks |
Pagination
When an index endpoint is queried, such as /goals
, pagination headers will be returned. The headers will look like the following:
Link <https://api.sandbox.capablehealth.com/goals?page=1>; rel="first", <https://api.sandbox.capablehealth.com/goals?page=2>; rel="next", <https://api.sandbox.capablehealth.com/goals?page=10>; rel="last"
Current-Page 1
Page-Items 20
Total-Pages 10
Total-Count 200
You may query specific pages by appending a ?page=[PAGE_NUMBER]
query string parameter on requests to index endpoints. For example, /goals?page=2
will return the second page of goals results.
Header | Description |
---|---|
Link | The Link header is compatible with RFC8288. |
Current-Page | Current-Page indicates the page currently being queried. |
Page-Items | Page-Items indicates the number of items per page. |
Total-Pages | Total-Page indicates how many pages there are total. |
Total-Count | Total-Count provides the total amount of results in the query. |
Updated 1 day ago