Products - חיפוש מחיר של מספר מוצרים

Search for products using various query params.

* This operation supports location based search, See related parameters below.

Request parameters: 

At the moment we allow to filter by each of the fields set in the database. You can use these fields for sending a query by example request or for constructing filters. These are the fields:

Optional filter fields

  • chain_id - Optional filter field
  • sub_chain_id
  • store_id
  • bikoret_no
  • item_id
  • item_code
  • item_code_short
  • item_type
  • item_name
  • price_update_date
  • price_update_date_sec
  • manufacturer_name
  • manufacturer_country
  • manufacturer_item_description
  • unit_qty
  • quantity
  • unit_of_measure
  • bis_weighted
  • qty_in_package
  • item_price
  • unit_of_measure_price
  • allow_discount
  • item_status
  • sys_updated_date
  • sys_updated_date_sec

Store parameters

  • include_store_data: set true to add basic store data into products items. Setting this paremeter to true is also a precondition for using location based search,
  • latitude: for searching by location set this parameter with latitude coordinate. 
  • longitude: for searching by location set this parameter with longitude coordinate.   
  • distance: when searching by location you can use this optional parameter to specify the distance from store's location. Value represents distences from store position in "meters" for which you would like to get positive response.

Note that for location based search both 'latitude' and 'longitude' must be provided. The 'distance' os optiona and if not provided distance is set to default of 30 meters.  

Sample code: 

Sample code for of query-by-example


/**
 * In the first example we are using Query By Example applied on two fields 'chain_id' and 'store_id'
 * The 'limit' and 'page' parameters are optional
 */

$params = array(
    "api_key" => "YOUR_API_KEY", // or "access_token" => "some-token"
    "chain_id" => "7290492000005",
    "store_id" => "501",

);
$url = "http://api.priceli.co.il/v1/priceli/products";
$response = curlGET($url, $params);
$data = json_decode($response);
echoResponse($response);

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

} else if ($data->status == 2) {
    //no data! do something

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

Sample code of constructing filters and sending in request

<?php

/**
 * In the second example we construct a filter and calling the operation.
 */

$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://api.priceli.co.il/v1/priceli/products" ;
$response = curlGET($url, $params);
$data = json_decode($response);
echoResponse($response);

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

} else if ($data->status == 2) {
    //no data! do something

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


function echoResponse($response) {
    echo '<html><head><meta charset="UTF-8"></head><body>';
    echo $response;
    echo '</body></html>';
}

function curlGET($url, $data, &$errorBuf = null) {
    if ($data == null) {
        $data = array();
    }
    $url = $url . "?" . http_build_query($data);

    $curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_URL => $url,
    ));
    $response = curl_exec($curl);
    if (!$response) {
        $response = false;
        if ($errorBuf != null) {
            $errorBuf = curl_error($curl);
        }
    }
    curl_close($curl);
    return $response;
}
?>
Sample Response : 

{
  "status": 1,
  "count": 100,
  "total": 3930,
  "pageLimit": 100,
  "pageNum": 1,
  "data": [
    {
      "id": "3757",
      "chain_id": "7290492000005",
      "sub_chain_id": "1",
      "store_id": "501",
      "bikoret_no": "9",
      "item_id": null,
      "item_code": "7290010328505",
      "item_code_short": "328505",
      "item_type": "1",
      "item_name": "חטיפי חלבה ללא סוכר",
      "price_update_date": "2015-01-01 00:00:00",
      "price_update_date_sec": "0",
      "manufacturer_name": null,
      "manufacturer_country": null,
      "manufacturer_item_description": null,
      "unit_qty": "גרמים",
      "quantity": "150.00",
      "unit_of_measure": null,
      "bis_weighted": null,
      "qty_in_package": "15",
      "item_price": "12.90",
      "unit_of_measure_price": "8.60",
      "allow_discount": "1",
      "item_status": "1",
      "sys_updated_date": "2015-06-03 14:45:31",
      "sys_updated_date_sec": "1433331931"
    },
    {
      "id": "3784",
      "chain_id": "7290492000005",
      "sub_chain_id": "1",
      "store_id": "501",
      "bikoret_no": "9",
      "item_id": null,
      "item_code": "7290014094475",
      "item_code_short": "4094475",
      "item_type": "1",
      "item_name": "רוטב צילי מתוק ××”×¨×•× ",
      "price_update_date": "2015-05-18 11:12:30",
      "price_update_date_sec": "0",
      "manufacturer_name": null,
      "manufacturer_country": null,
      "manufacturer_item_description": null,
      "unit_qty": "מיליליטרים",
      "quantity": "700.00",
      "unit_of_measure": null,
      "bis_weighted": null,
      "qty_in_package": "1",
      "item_price": "14.30",
      "unit_of_measure_price": "2.04",
      "allow_discount": "1",
      "item_status": "1",
      "sys_updated_date": "2015-06-03 14:45:31",
      "sys_updated_date_sec": "1433331931"
    },
   ....
    ]
}

Required Creadential: 
API Key
OR Access Token