how to Filter users based on a particular field?

Hello! I'm trying to retrieve a user by their user_name property. Below is the URL I'm calling with HTTP GET. I get no results. However, when I remove the filter query parameter, I can see this user along with all other users. What's wrong here? The documentation is really vague about it. Concrete examples with the URL would've been much clearer.

https://nykizq7354.trial.sugarcrm.eu/rest/v10/Users?filter%5B0%5D%5Buser_name%5D%3Dscm-curl2%40blah.com&… 

The URL decoded value of the filter parameter above is 

filter[0][user_name]=scm-curl2@blah.com

Parents Reply Children
  • Hi admin guy 

    How and where do you try this request?

    I just tried in a PHP script and it worked without big deal.

    $filter_arguments = array(
       "filter" => array(
          array(
             "user_name" => $user_name,
          ),
       ),
       "max_num" => 5,
       "offset" => 0,
       "fields" => "id,user_name,first_name,last_name",
       "order_by" => "date_entered",
       "favorites" => false,
       "my_items" => false,
    );


    curl_setopt($request, CURLOPT_POSTFIELDS, json_encode($filter_arguments));

    $response = json_decode(curl_exec($request));

    Kind regards

    André Lopes
    Lampada Global
    Skype: andre.lampada