Query filtering
Some endpoints have fields that can be used to filter the results. The filterable fields
can be seen at the top of your Provet Cloud REST API endpoint page
(eg. https://provetcloud.com/<provet_id>/api/0.1/consultation/) if the endpoint has
filterable fields.
Operations
The following methods are available for filtering (synonyms are comma-separated):
is,eqEqual
is_not,not_eq,neqNot equal
ltLess than
lteLess than or equal
gtGreater than
gteGreater than or equal
rangeValues between, needs two values in order [from,to]
not_in_rangeAbove inversed
containsText contains the searched text, case-sensitive
contains_notAbove inversed
icontainsText contains the searched text, case-insensitive
icontains_notAbove inversed
inItem is found in the given list [value1,value2,value3]
not_inAbove inversed
is_nulltrue or false
The filtering methods can be used with query parameters using the following syntaxes:
[field]__[method]=value
(eg. client__is=10 which uses the ID of the client for the search)
[field].[property]__[method]=value
(eg. client.id__is=10)
Datetime values
Note that dates should be given for the query parameters in the format
YYYY-MM-DD hh:mm+[TimeZone]hh:mm (eg. 2017-12-24 15:30+00:00).
Examples
If we need to find all consultations with the conditions
complaint contains the word “vacc” (case-insensitive)
the admitted_time is between 2017-12-01 00:00+00:00 (greater than or equal) and 2018-01-01 00:00+00:00 (less than)
department ID is 1
client ID is 10
one of the patients’ ID in the consultation is 20
we would use the following URL:
https://provetcloud.com/<provet_id>/api/0.1/consultation/
?complaint__icontains=vacc
&admitted_time__gte=2017-12-01 00:00%2B00:00
&admitted_time__lt=2018-01-01 00:00%2B00:00
&department__is=1
&client__is=10
&patients__is=20
Note that “+” signs are URL encoded (%2B) in the above example for the URL to work.
If we need to find all consultations where
the client’s first name is John and
the client’s last name is Doe
we would use the following URL:
https://provetcloud.com/<provet_id>/api/0.1/consultation/
?client.firstname__is=John
&client.lastname__is=Doe