The GET one and GET many endpoints for each model accept a query parameter called "filter" for limiting results based on specific fields/values. A practical example of using "filter" is described here.
Basic Filters
Base Field
To search for an Enduser with a specific email, you could use this filter:
{ "filter": { "email": "email.to.match@example.com" } }
To search for an Enduser by both first and last nane:
{ "filter": { "fname": "John", "lname": "Doe" } }
Nested Fields
To search for an Enduser with a specific payer by name (insurance.payerName), you could use this filter:
{ "filter": { "insurance": { "payerName": "Example Payer" } } }
Advanced Filters
_exists: true(false) matches if a given field is(not) set
_in matches any of the values provided
{ "filter": { "email": { "_in": ["e1@example.com", "e2@gmail.com"] } } }
_nin matches when none of the provided values in a list match
_ne matches when a single value does not match
_all matches list fields which include all of the provided values
- Matching endusers by one tag
{ "filter": { "tags": { "_all": ["tag1"] } } }
- Matching endusers by multiple tags
{ "filter": { "tags": { "_all": ["has", "all", "these", "tags"] } } }
_lt, _lte, _gt, and _gte represent comparisons for number fields (less than, less than or equal, greater than, greater than or equal)
MongoDB Style Filters
These endpoints also accept a parameter called mdbFilter, which accepts MongoDB query JSON. This allows for more flexibility by supporting options like $and, $or, and the rest of MongoDB's query operators.
If you're unfamiliar with MongoDB and want to easily test filters, you can use this tool without needing to spin up your own database:
Comments
0 comments
Please sign in to leave a comment.