Promotions By sys_code - מבצעים לפי קוד מערכת

This operation return promotions related with product's sys_code. Internally the sys code is break into chan_id, store_id and item_code and a combined filter is composed. 

Request parameters: 

Required paramete

  • sys_code -  The value may contain a single code, array of codes or comma delimited string of codes.

Location based parameters

  • latitude - latitude coordinates from geolocation system
  • longitude  - longitude  coordinates from geolocation system
  • distance - the distance from the provided location for which to include stores.
Sample code: 
<?php

$params = array(
    "api_key" => "####-prod", // 
    "sys_code" => "7290055700007|021|324",
    //"sys_code" => array([code1],[code2],[code3],......), You can also use array
    //"sys_code" => "[code1],[code2],[code3]......, You can also use comma delimited string
);
$url = "http://api.priceli.co.il:8080/v1/priceli/promotions-by-sys-code";
$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;
}


?%gt;