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
,eq
Equal
is_not
,not_eq
,neq
Not equal
lt
Less than
lte
Less than or equal
gt
Greater than
gte
Greater than or equal
range
Values between, needs two values in order [from,to]
not_in_range
Above inversed
contains
Text contains the searched text, case-sensitive
contains_not
Above inversed
icontains
Text contains the searched text, case-insensitive
icontains_not
Above inversed
in
Item is found in the given list [value1,value2,value3]
not_in
Above inversed
is_null
true 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