Include/Exclude Fields from API Response
Overview
The fields
parameter is an inclusive filter that accepts a comma-separated string of field names to include on Provider objects. The _excl_fields
parameter is an exclusive filter that accepts a comma-separated string of field names to exclude.
Example
Before we try applying either of these parameters, let's try a basic provider search request:
https://api.ribbonhealth.com/v1/custom/providers?specialty=Dermatology&address=10014
In the API Response, we see there's a lot of valuable detailed data that Ribbon provides in the response. But searching for the entire Provider object can be time intensive - some providers have tens of thousands of rows of data across the locations
and insurances
.
Instead, if we know which fields we need, we can narrow the response size to make searches blazingly fast! For this example, let's say we only care about the locations a provider practices at. Let's use the fields
parameter to narrow down the response:
https://api.ribbonhealth.com/v1/custom/providers?specialty=Dermatology&address=10014&fields=locations
You can see this reduces the size of the response by more than half!
Exclude Fields
Similarly, if we care about every field except locations, we can exclude from the API Response with the _excl_fields
parameter:
https://api.ribbonhealth.com/v1/custom/providers?specialty=Dermatology&address=10014&_excl_fields=locations
If you try this out, you'll see that locations are nowhere to be found in the response! Both of these methods reduce the response time of requests and allow you to build more delightful user experiences using Ribbon's API.
Updated about 1 year ago