Stores - חיפוש חנויות

Get stores using filter params. 

Request parameters: 

The following parameters can be used alone or in combine to compose a filter by which to get stores. For example using "chain_id" will get all stores of a chain. You can send to api flat list of parameters to filter by that will provide a query by example search  using Equal To operator, or you can construct a filter and send to api as explained here

  • chain_id - the supermarket chain_id 
  • sub_chain_id
  • store_id
  • bikoret_no
  • store_type
  • chain_name
  • sub_chain_name
  • store_name
  • address
  • city
  • zip_code
  • sys_updated_date
  • sys_updated_date_sec

Location based seearch parameters:

  • 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: 

<?php

$params = array(
    "api_key" => "YOUR_API_KEY", // or "access_token" => "some-token"
    "chain_id" => "7290492000005",
);
$url = "http://api.priceli.co.il/v1/priceli/stores";
$response = curlGET($url, $params);
$data = json_decode($response);
echoResponse($response);

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

} 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": 82,
  "total": 82,
  "pageLimit": -1,
  "pageNum": 1,
  "data": [
    {
      "id": "1",
      "chain_id": "7290492000005",
      "sub_chain_id": "1",
      "store_id": "501",
      "bikoret_no": "1",
      "store_type": "1",
      "chain_name": "Dor Alon",
      "sub_chain_name": "1",
      "store_name": "בן יהודה",
      "address": "בן יהודה 30",
      "city": "תל אביב",
      "zip_code": "6380407",
      "sys_updated_date": "2015-06-04 09:58:48",
      "sys_updated_date_sec": "1433609333"
    },
    {
      "id": "2",
      "chain_id": "7290492000005",
      "sub_chain_id": "1",
      "store_id": "502",
      "bikoret_no": "0",
      "store_type": "1",
      "chain_name": "Dor Alon",
      "sub_chain_name": "1",
      "store_name": "×¤×™× ×¡×§×¨",
      "address": "×¤×™× ×¡×§×¨ 10",
      "city": "תל אביב",
      "zip_code": "6332315",
      "sys_updated_date": "2015-06-04 09:58:48",
      "sys_updated_date_sec": "1433609333"
    }
    .........

  ],
  "Time_taken": null
}

Required Creadential: 
API Key
OR Access Token