AnsweredAssumed Answered

How to combine filters in URL?

Question asked by Francesca Shiekh on Sep 6, 2016
Latest reply on Sep 7, 2016 by Tevfik Tümer
I was looking for examples on how to use the filters in the URL and found this:

In these examples they have the filters in a more 'readable' format:
/rest/v10/Accounts/demo_burger_palace/link/contacts?filter[0][last_name][$starts]=b&filter[0][first_name][$starts]=b&filter[0][$favorite]=_this&fields=name,first_name,last_name,email,description
So if I wanted to filter by
((first_name starts with F) OR (first_name starts with A)) AND (last_name equals Shiekh) the array format would be:

 

$filter = array (
  array( //the And
    array( //the first element of the And
      'last_name' => array('$eq' => 'shiekh')
    ),
    array( //the second element of the And
      '$or' => array( //the OR
         array( //the first element of the Or
           'first_name'=>array('$starts' => 'F)
         ),
         array( //the second element of the Or
           'first_name => array('$starts' => 'A')
         ),
     ), //close the Or
  ), //close the And
) //close the filter

 

But I have not yet figured out how to get the "or" into a filter URL

 

I would think the parts would be something like:

 

filter[0][last_name][$eq]=Shiekh

 

filter[1][first_name][$starts]=F
 
filter[2][first_name][$starts]=A

 

But how to combine the three?
thanks,
FrancescaS

Outcomes