AnsweredAssumed Answered

SugarCrm 7.6 complicated filterList with C#

Question asked by nupurgupta nupurgupta on Oct 21, 2015
From my web browser, I am trying to execute a complicated query to fetch a list of contacts. I am doing this by creating a page in C#. So for a query in PHP as 

//Filter - //filter POST
$filter_arguments = array(
     "filter" => array(
         array(
             '$or' => array(
                 array(       
                     "first_name" => array(
                         '$starts'=>"Sama",
                     )
                 ),
                 array(           
                     "last_name" => "Jamieson"
                 )
             ),
         ),
     ),
     "max_num" => 5,
     "offset" => 0,
     "fields" => "name,description",       
);

Then I follow the Sugar documentation on making the query.
Now I need to make this query in C#. The simplest way would be to replicate the JSON payload that this corresponds to. However, for a query like this, the JSON is 
{"filter":[{"$or":[{"first_name":{"$starts":"Sama"}},{"last_name":"Jamieson"}]}],

which is quite painful to recreate. Basically its a list of a dictionary of a list.....And the query is getting more complex. Is there an easier way to do this? There is a 'q' field in the /Contacts/filter GET method, but no documentation on how to construct the query. Is this available somewhere?
Can I use SugarQuery? Can this be executed from the browser end, in which case, the documentation for this is needed.

Outcomes