AnsweredAssumed Answered

SugarCRM 7.6 filter POST fetching results incorrectly

Question asked by nupurgupta nupurgupta on Oct 21, 2015
I am trying the POST filter as per the php on the examples page.. the relevant part of my php looks like. I want only results for 'Joseph Groom', but the following is returning  all Joseph's and all Groom's. What is wrong in the below?

//Filter - //filter POST
$filter_arguments = array(
       "filter" => array(
         '$and' => array(
              array(
                 array
                 (
                    '$or' => array
                    (
                        array("first_name" => "Joseph"),
                        array("last_name" => "Joseph")
                     ),
                ),
                 array
                 (
                    '$or' => array
                    (
                         array("first_name" => "Groom"),
                         array("last_name" => "Groom")
                    ),
                ),
           ),
         )
      ),
     "fields" => "name,description",
     "order_by" => "name:DESC",
);

$url = $base_url . "/Contacts/filter";

$filter_response = call($url, $oauth2_token_response->access_token, 'POST', $filter_arguments);

Outcomes