Sending request with filters

When searching for lists of itmes (products or promotions) it is possible to construct a filter on the client side and send this filter to the server. This provide more flexability then just using query by example by sending parameters with given value. To send a filter the "filters" field need to be sent in a way thatr is cistructed as an associative array (in terms of PHP) or multilevel HashMap (in terms of Java).

A syntax for setting a single condition is:

$filters[ column-name ] => array("conditional" => [ condition-name ] ,  values => [either single value or array])

Condition-Name is one of the below values:
 EQUAL_TO  
 NOT_EQUAL_TO
 LESS_THAN
 LESS_THAN_OR_EQUAL_TO 
 GREATER_THAN 
 GREATER_THAN_OR_EQUAL_TO
 LIKE
 NOT_LIKE
 BETWEEN
 BITWISE_AND 
 NULL
 NOT_NULL 

 

 

 

Sample code: 
$filter = array(
    "chain_id" => array("conditional" => "EQUAL_TO",  "values" =>  "7290492000005"),
    "store_id" => array("conditional" => "IN",  "values" =>  array(501, 502)),
    "item_code" => array("conditional" => "EQUAL_TO",  "values" =>  "4014400901191"),
);

$params = array(
    "api_key" => "YOUR_API_KEY", // or "access_token" => "some-token"
    "filter" => $filter
);
$url = "http://local.api.priceli.co.il:8080/v1/priceli/products" ;
$response = curlGET($url, $params);
$data = json_decode($response);
echo $response;

if ($data->status == 1) {
    //do something with product data

} else {
    echo "Error occur: " . $data->message;
}