NAV Navbar
cUrl NodeJS PHP Ruby JavaScript

Introduction

Footprints is the advanced AI marketing platform for behavioral profiling of physical customers, anticipating their next move and improving their customer experience.

Authentication

To authorize, use this code:

    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/token")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request["Authorization"] = 'Basic base64('{{key}}:{{secret}}')'
    request.body = "grant_type=client_credentials&pin=1234567890"
    
    response = http.request(request)
    puts response.read_body
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "http://{{base_url}}/api/token", 
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "grant_type=client_credentials&pin=1234567890",
    CURLOPT_HTTPHEADER => array(
      "Authorization: Basic base64('{{key}}:{{secret}}')",
      "Content-Type: application/x-www-form-urlencoded"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

curl --request POST \
--url 'http://{{base_url}}/api/token' \
--header 'Authorization: Basic base64('\''{{key}}:{{secret}}'\'')' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials&pin=1234567890
    var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "token"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded",
        "Authorization": "Basic base64('{{key}}:{{secret}}')"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ grant_type: 'client_credentials', pin=1234567890 }));
    req.end();  

The above command returns JSON structured like this:

{
      "access_token": "3a53f15f7382f61564e3b16a3b81a37354c88f391263adf31be953e80b3f3",
      "token_type": "bearer",
      "expires_in": 31535999,
      "refresh_token": "903173e6a53ae2d6c238ed50ccd1db5b42cb967ce408d370b3f3257eh7e0e295",
      "scope": [
          "app_scope",
          "hostess_scope"
      ],
      "hostess_name": "Test Hostess",
      "hostess_id": "5b30cb85e1267446c5784b75" 
}

You can ask for an API key at support@footprintsforretail.com.

Headers

Content-Type application/x-www-form-urlencoded
 Authorization Basic base64('{{key}}:{{secret}}')

HTTP Request

POST {{base_url}}/api/token

Query Parameters

Parameter Description
grant_type values: client_credentials, password, pin
pin string (field used with grant_type = "pin")
username string (field used with grant_type = "password")
password string (field used with grant_type = "password")

Leads

Add Lead

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/lead?access_token={{access_token}}")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "userFirstName=Test&userLastName=Test&userEmail=test@test.com&userPhone=0700000000"
    
    response = http.request(request)
    puts response.read_body

    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/lead?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "userFirstName=Test&userLastName=Test&userEmail=test@test.com&userPhone=0700000000",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request POST \
    --url 'http://{{base_url}}/api/lead?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'userFirstName=Test&userLastName=Test&userEmail=test@test.com&userPhone=0700000000'
   var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "offerCategory",
        "{{offerCategoryId}}",
        "lead"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ userFirstName: 'Test',
      userLastName: 'Test',
      userEmail: 'test@test.com',
      userPhone: '0700000000' }));
    req.end();

The above command returns JSON structured like this:

 {
      "_id": "6h7adfb9f58363518b370051"
 }

Add new lead method

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/api/lead

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
offlineCampaignIdoffline campaign id
offerCategoryIdoffer category id
offerIdoffer id
locationIdlocation id
consultantIdconsultant id
channelIdchannel id (please check List Channels method)
userFirstNameuser's first name
userLastNameuser's last name
userEmailuser's email address
userPhoneuser's phone
npsmin:0 max:10 - net promoter score - user's rating
userSexpossible values: male, female
userCityuser's city
userCountyuser's county
userCountryuser's country
userAddressuser's address
userFamilyDetalispossible values: "single","married"
userChildrenuser's number of children
userIndustryuser's industry
userCompanyNameuser's company
userCompanyAddressuser's company address
userJobuser's job
userJobDescriptionuser's job description
userIncomeuser's income
userBirthdayuser's birthday, accepted format Y-m-d
userExternalIduser's id from the primary database
userDistrictuser's district
facebookUrlFacebook user profile
imageUrluser profile picture
tagsarray de strings ['tagName1', 'tagName2']
createdAtdate, accepted format Y-m-d H:i:s
timezonethe IANA time zone identifier, eg. America/Los_Angeles
marketingChannelsarray containing objects like channel ('sms', 'email', 'notification', 'dm', 'socialMedia'), type ('owner', 'group', 'partners'), agreed ("true", "false")
customDetailsoptional object; ex: customDetails[offerDetails] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit' or customDetails[vouchers] = ['shopId'=>1,'shopName'=>'sn', 'amount'=>22, 'currency'=>'RON']
userCommentsstring containing user comments
hasKidspossible values: "true", "false"
noOfKidsnumber of kids
agreeTandcTerms & Conditions Agreement, possible values: "true", "false"
agreePrivacyPrivacy Policy Agreement, possible values: "true", "false"
agreedTargetedMessagesPersonalized Messages Agreement possible values: "true", "false"
isAdultpossible values: "true", "false"
[customVariableName]The names for the custom variables need to be declared first in "Settings > Custom Variables" otherwise they'll be ignored

Update Lead

Use the access token obtained from authentication method:


      require "uri"
      require "net/http"
      
      url = URI("{{base_url}}/api/lead/5ce3b4089d5de975003244d2?access_token={{access_token}}")
      
      http = Net::HTTP.new(url.host, url.port)
      
      request = Net::HTTP::Put.new(url)
      request["Content-Type"] = "application/x-www-form-urlencoded"
      request.body = "status=sale_lead"
      
      response = http.request(request)
      puts response.read_body

  $curl = curl_init();

  curl_setopt_array($curl, array(
    CURLOPT_URL => "{{base_url}}/api/lead/5ce3b4089d5de975003244d2?access_token={{access_token}}",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_POSTFIELDS => "status=sale_lead",
    CURLOPT_HTTPHEADER => array(
      "Content-Type: application/x-www-form-urlencoded"
    ),
  ));
  
  $response = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  
  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  } 
   curl --location --request PUT "{{base_url}}/api/lead/5ce3b4089d5de975003244d2?access_token={{access_token}}" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "status=sale_lead"
   var https = require('https');

  var qs = require('querystring');
  
  var options = {
    'method': 'PUT',
    'hostname': '{{base_url}}',
    'path': '/api/lead/5ce3b4089d5de975003244d2?access_token={{access_token}}',
    'headers': {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  };
  
  var req = https.request(options, function (res) {
    var chunks = [];
  
    res.on("data", function (chunk) {
      chunks.push(chunk);
    });
  
    res.on("end", function (chunk) {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
    });
  
    res.on("error", function (error) {
      console.error(error);
    });
  });
  
  var postData = qs.stringify({
    'status': 'sale_lead'
  });
  
  req.write(postData);
  
  req.end();

The above command returns JSON structured like this:

 {
  "_id": "5ebe9558aea45e10fc094c8b",
  "timestamp": "2020-03-15 16:12:56",
  "createdAt": "2020-03-15 16:12:56",
  "status": "customer",
  "userFirstName": "First Name",
  "userLastName": "Last Name",
  "userPhone": "0700000118",
  "userEmail": "test5557@test.com",
  "locationId": "5cf92039bc79te5cf99e3540",
  "offerId": "5cf92a83bc790a5cf99e35cf",
  "updatedAt": "2020-03-15 16:12:56",
  "consultantId": "59f8530f0et24a7c9247cuew7",
  "assignedBefore": 1,
  "skuId": "5e6b7be8576e5213f065b23c",
  "contractId": "5ebe97b8d6772218b0a76785",
  "skuExternalId": "12345"
}

Update lead method

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

PUT {{base_url}}/api/lead/{{leadId}}

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
userCompanyNameuser's company
userCompanyAddressuser's company address
statuslead status; accepted values: prospect, lead, sale_lead, opportunity, customer, lost
skuIdnew sku id assigned (please check List SKUs method)
channelIdnew sku id assigned (please check List Channels method)
skuExternalIdexternal sku code (not mandatory)
contractNumbercontract number number (only with status customer)
contractValuecontract value (only with status customer)
contractDatecontract date (only with status customer)
contractDescriptioncontract description (only with status customer)
tagsarray de strings ['tagName1', 'tagName2']

Get Leads

Use the access token obtained from authentication method:


        require "uri"
        require "net/http"
        
        url = URI("{{base_url}}/api/lead?access_token={{access_token}}&startDate=2018-11-25&endDate=2018-12-31&pageSize=10&page=1")
        
        http = Net::HTTP.new(url.host, url.port)
        
        request = Net::HTTP::Get.new(url)
        request["Content-Type"] = "application/x-www-form-urlencoded"
        
        response = http.request(request)
        puts response.read_body

    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "{{base_url}}/api/lead?access_token={{access_token}}&startDate=2018-11-25&endDate=2018-12-31&pageSize=10&page=1",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => false,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --location --request GET "{{base_url}}/api/lead?access_token={{access_token}}&startDate=2018-11-25&endDate=2018-12-31&pageSize=10&page=1" \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --data ""
   var https = require('https');

    var qs = require('querystring');
    
    var options = {
      'method': 'GET',
      'hostname': '{{base_url}}',
      'path': '/api/lead?access_token={{access_token}}&startDate=2018-11-25&endDate=2018-12-31&pageSize=10&page=1',
      'headers': {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    };
    
    var req = https.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function (chunk) {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    
      res.on("error", function (error) {
        console.error(error);
      });
    });
    
    var postData = qs.stringify({
    
    });
    
    req.write(postData);
    
    req.end();

The above command returns JSON structured like this:

 [{
    "_id": "5ce3b4089d5de975003244d2",
    "userFirstName": "Kibo",
    "userLastName": "English",
    "userEmail": "Duis.dignissim@vulputate.org",
    "userPhone": "0700000000",
    "offerId": "5aa2082c75d87fbce2e76ada",
    "industryId": "5b8561bd0bb67c30c35df800",
    "offlineCampaignId": "5af77643f09b7f2c2fa3007e",
    "locationId": "86f838e268a157484ba1d658",
    "clientId": "5cs37a5083e3aa47a4a6a03e",
    "status": "sale_lead",
    "userCountry": "Romania",
    "userFamilyDetails": "relationship",
    "userBirthday": "Fri Oct 21 1960 00:00:00 GMT+0000 (UTC)",
    "userIncome": "8004",
    "agreeToCollect": true,
    "agreeTandc": true,
    "isAdult": true,
    "isMultipart": false,
    "isComplete": true,
    "timestamp": "2018-09-24T19:00:00.000Z",
    "timestampStatusChange": "2018-09-24T19:00:00.000Z",
    "createdAt": "2018-09-24T19:00:00.000Z",
    "actionRequired": true,
    "deviceType": "desktop",
    "skuExternalId": "12345",
    "offerCategoryId": "5cf92a83bc790a5cf99e35cd",
    "offerCategory": "Footprints for Retail",
    "offer": {
      "_id": "5cf92a83bc710a5cf22e35cf",
      "name": "OFFER NAME",
      "price": 800
    },
    "sku": {
        "_id": "5e6b7be8576e5213f065b23c",
        "name": "SKU NAME",
        "price": 400
    },
    "updatedAt": "2019-07-18T12:47:35.847Z",
    "channelId": "2f3e2b658720346d675b441c",
    "consultant": {
      "_id": "51f853626e3f13wc9247c623",
      "name": "Test Test"
    }
}]

Get leads method (will return only the leads with locationId, offerCategoryId, offerId and consultantId asociated)

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/lead

Query Parameters

Parameter Description
access_token access token
startDate start date, accepted format Y-m-d
endDate start date, accepted format Y-m-d
pageSize items per page
page current page
appKey application key

Add Lead Action

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/lead/action?access_token={{access_token}}")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "leadId=5b73fhfc4f58363318b824431&leadActionTypeId=6d22kaal8378716180494f54&actionDetail=description&date=2021-01-12 06:42:55"
    
    response = http.request(request)
    puts response.read_body

    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/lead/action?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "leadId=5b73fhfc4f58363318b824431&leadActionTypeId=6d22kaal8378716180494f54&actionDetail=description&date=2021-01-12 06:42:55",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request POST \
    --url 'http://{{base_url}}/api/lead/action?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'leadId=5b73fhfc4f58363318b824431&leadActionTypeId=6d22kaal8378716180494f54&actionDetail=description&date=2021-01-12 06:42:55'
   var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "lead",
        "action"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ leadId: '5b73fhfc4f58363318b824431',
      leadActionTypeId: '6d22kaal8378716180494f54',
      actionDetail: 'description',
      date: '2021-01-12 06:42:55' }));
    req.end();

The above command returns JSON structured like this:

 {
      "status": "success",
      "_id": "6h7adfb9f58363518b370051"
 }

Add new lead action method

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/api/lead/action

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
leadIdlead id
leadActionTypeIdaction type id (please check Get Lead Action Types method)
actionDetaildescription
datedate, accepted format Y-m-d H:i:s

Update Lead Action

Use the access token obtained from authentication method:


            require 'uri'
            require 'net/http'
            
            url = URI("https://{{base_url}}/api/lead/action/{{actionId}}?access_token={{access_token}}")
            
            http = Net::HTTP.new(url.host, url.port)
            
            request = Net::HTTP::Put.new(url)
            request["Content-Type"] = 'application/x-www-form-urlencoded'
            request.body = "leadId=5b73fhfc4f58363318b824431&leadActionTypeId=6d22kaal8378716180494f54&actionDetail=description&date=2021-01-12 06:42:55"
            
            response = http.request(request)
            puts response.read_body
        

            $curl = curl_init();
        
            curl_setopt_array($curl, array(
              CURLOPT_URL => "http://{{base_url}}/api/lead/action/{{actionId}}?access_token={{access_token}}",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_ENCODING => "",
              CURLOPT_MAXREDIRS => 10,
              CURLOPT_TIMEOUT => 30,
              CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
              CURLOPT_CUSTOMREQUEST => "PUT",
              CURLOPT_POSTFIELDS => "leadId=5b73fhfc4f58363318b824431&leadActionTypeId=6d22kaal8378716180494f54&actionDetail=description&date=2021-01-12 06:42:55",
              CURLOPT_HTTPHEADER => array(
                "Content-Type: application/x-www-form-urlencoded"
              ),
            ));
            
            $response = curl_exec($curl);
            $err = curl_error($curl);
            
            curl_close($curl);
            
            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
        
   curl --request PUT \
            --url 'http://{{base_url}}/api/lead/action/{{actionId}}?access_token={{access_token}}' \
            --header 'Content-Type: application/x-www-form-urlencoded' \
            --data 'leadId=5b73fhfc4f58363318b824431&leadActionTypeId=6d22kaal8378716180494f54&actionDetail=description&date=2021-01-12 06:42:55'
        
   var qs = require("querystring");
            var http = require("http");
            
            var options = {
              "method": "PUT",
              "hostname": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "lead",
                "action",
                {{actionId}}
              ],
              "headers": {
                "Content-Type": "application/x-www-form-urlencoded"
              }
            };
            
            var req = http.request(options, function (res) {
              var chunks = [];
            
              res.on("data", function (chunk) {
                chunks.push(chunk);
              });
            
              res.on("end", function () {
                var body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });
            
            req.write(qs.stringify({ leadId: '5b73fhfc4f58363318b824431',
              leadActionTypeId: '6d22kaal8378716180494f54',
              actionDetail: 'description',
              date: '2021-01-12 06:42:55' }));
            req.end();
        

The above command returns JSON structured like this:

 {
              "status": "success",
              "_id": "6h7adfb9f58363518b370051"
         }
        

Updates lead action method

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

PUT {{base_url}}/api/lead/action/{{actionId}}

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
leadIdlead id
leadActionTypeIdaction type id (please check Get Lead Action Types method)
actionDetaildescription
datedate, accepted format Y-m-d H:i:s

Get Lead Actions

Use the access token obtained from authentication method:


        require "uri"
        require "net/http"
        
        url = URI("{{base_url}}/api/lead/actions/{{leadId}}?access_token={{access_token}}")
        
        http = Net::HTTP.new(url.host, url.port)
        
        request = Net::HTTP::Get.new(url)
        request["Content-Type"] = "application/x-www-form-urlencoded"
        
        response = http.request(request)
        puts response.read_body

    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "{{base_url}}/api/lead/actions/{{leadId}}?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => false,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --location --request GET "{{base_url}}/api/lead/actions/{{leadId}}?access_token={{access_token}}" \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --data ""
   var https = require('https');

    var qs = require('querystring');
    
    var options = {
      'method': 'GET',
      'hostname': '{{base_url}}',
      'path': '/api/lead/actions/{{leadId}}?access_token={{access_token}}',
      'headers': {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    };
    
    var req = https.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function (chunk) {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    
      res.on("error", function (error) {
        console.error(error);
      });
    });
    
    var postData = qs.stringify({
    
    });
    
    req.write(postData);
    
    req.end();

The above command returns JSON structured like this:

 [
  data: [{
    "_id": "5ce3b4089d5de975003244d2",
    "leadId": "6ee3b4089d5de9750035561",
    "actionDetail": "My description",
    "leadActionTypeId": {
      "_id": "6d23b4089d5de672354dd7878",
      "name": "Test Test"
    },
    "attachments": [],
    "date": "2017-07-18T12:47:35.847Z",
    "createdAt": "2019-07-18T12:47:35.847Z",
    "updatedAt": "2020-08-19T12:57:35.847Z"    
}]

Get all actions associated to a specific lead

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/lead/actions/{{leadId}}

Query Parameters

Parameter Description
access_token access token

Get Lead Action Types

Use the access token obtained from authentication method:


        require "uri"
        require "net/http"
        
        url = URI("{{base_url}}/api/lead/action-types?access_token={{access_token}}")
        
        http = Net::HTTP.new(url.host, url.port)
        
        request = Net::HTTP::Get.new(url)
        request["Content-Type"] = "application/x-www-form-urlencoded"
        
        response = http.request(request)
        puts response.read_body

    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "{{base_url}}/api/lead/action-types?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => false,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --location --request GET "{{base_url}}/api/lead/actions/{{leadId}}?access_token={{access_token}}" \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --data ""
   var https = require('https');

    var qs = require('querystring');
    
    var options = {
      'method': 'GET',
      'hostname': '{{base_url}}',
      'path': '/api/lead/action-types?access_token={{access_token}}',
      'headers': {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    };
    
    var req = https.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function (chunk) {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    
      res.on("error", function (error) {
        console.error(error);
      });
    });
    
    var postData = qs.stringify({
    
    });
    
    req.write(postData);
    
    req.end();

The above command returns JSON structured like this:

 [
  data: [{
    "_id": "5ce3b4089d5de975003244d2",
    "name": "Type 1",
    "createdAt": "2019-07-18T12:47:35.847Z"  
}]

Get all lead action types declared inside the project

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/lead/action-types

Query Parameters

Parameter Description
access_token access token

Upload Lead Documents

Use the access token obtained from authentication method:


            require "uri"
            require "net/http"
            
            url = URI("{{base_url}}/api/lead/5fbc335fc3972a78dc85d7a0/contracts?access_token={{access_token}}")
            
            http = Net::HTTP.new(url.host, url.port);
            request = Net::HTTP::Put.new(url)
            request["Content-Type"] = "multipart/form-data"
            form_data = [['documents', File.open('C:/MyComputer/Documents/filename1.pdf')],['documents', File.open('C:/MyComputer/Documents/filename2.pdf')]]
            request.set_form form_data, 'multipart/form-data'
            response = http.request(request)
            puts response.read_body
        

            $curl = curl_init();

            curl_setopt_array($curl, array(
              CURLOPT_URL => '{{base_url}}/api/lead/5fbc335fc3972a78dc85d7a0/contracts?access_token={{access_token}}',
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_ENCODING => '',
              CURLOPT_MAXREDIRS => 10,
              CURLOPT_TIMEOUT => 0,
              CURLOPT_FOLLOWLOCATION => true,
              CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
              CURLOPT_CUSTOMREQUEST => 'PUT',
              CURLOPT_POSTFIELDS => array('documents'=> new CURLFILE('C:/MyComputer/Documents/filename1.pdf'),'documents'=> new CURLFILE('C:/MyComputer/Documents/filename2.pdf')),
              CURLOPT_HTTPHEADER => array(
                'Content-Type: multipart/form-data'
              ),
            ));
            
            $response = curl_exec($curl);
            $err = curl_error($curl);
            
            curl_close($curl);
            
            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
        
   
          curl --location --request PUT '{{base_url}}/api/lead/5fbc335fc3972a78dc85d7a0/contracts?access_token={{access_token}}' \
          --header 'Content-Type: multipart/form-data' \
          --form 'documents=@"/C:/MyComputer/Documents/filename1.pdf"' \
          --form 'documents=@"/C:/MyComputer/Documents/filename2.pdf"'
        
   var request = require('request');
          var fs = require('fs');
          var options = {
            'method': 'PUT',
            'url': '{{base_url}}/api/lead/5fbc335fc3972a78dc85d7a0/contracts?access_token=b24d050799760977e3884cbbb8d404dfeff778a2bf672b66fd3198998696d0356d9a006a4735a6aae85920b6b6c0bf98801c1dd1a34605cda96c9ce52d50526e',
            'headers': {
              'Content-Type': 'multipart/form-data'
            },
            formData: {
              'documents': {
                'value': fs.createReadStream('/C:/MyComputer/Documents/filename1.pdf'),
                'options': {
                  'filename': '/C:/MyComputer/Documents/filename1.pdf',
                  'contentType': null
                }
              },
              'documents': {
                'value': fs.createReadStream('/C:/MyComputer/Documents/filename2.pdf'),
                'options': {
                  'filename': '/C:/MyComputer/Documents/filename2.pdf',
                  'contentType': null
                }
              }
            }
          };
          request(options, function (error, response) {
            if (error) throw new Error(error);
            console.log(response.body);
          });
        

The above command returns JSON structured like this:

 {
          "status": "ok",
          "uploaded_files": [
              "filename1.pdf",
              "filename2.pdf"
          ]
        }
        

Upload lead documents method. The file data should be attached using standard multipart/form-data. Allowed documentType values are: "contracts","offers","consents" Allowed mimetype: "application/pdf"

Headers

Content-Type multipart/form-data

HTTP Request

PUT {{base_url}}/api/lead/{{leadId}}/{{documentType}}

Query Parameters

Parameter Description
access_token access token

Body formdata

Parameter Description
documentsone or multiple files can be added (max 5 files per upload)
leadActionIdoptional field for associating the document(s) to a lead action

Add prospect

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/prospect?access_token={{access_token}}")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "avandorUserId=&avandorSession=&userFirstName=Mihai&userLastName=Popescu&userEmail=mihai@popescu.com&userPhone=%2B075364628484&userCountry="
    
    response = http.request(request)
    puts response.read_body

    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/prospect?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "avandorUserId=&avandorSession=&userFirstName=Test&userLastName=Test&userEmail=test@test.com&userPhone=0700000000&userCountry=",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request POST \
    --url 'http://{{base_url}}/api/prospect?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'avandorUserId=&avandorSession=userFirstName=Test&userLastName=Test&userEmail=test@test.com&userPhone=0700000000&userCountry='
   var qs = require("querystring");
    var http = require("http");
    
    var options = { 
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "prospect"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ avandorUserId: '',
      avandorSession: '',
      userFirstName: 'Test',
      userLastName: 'Test',
      userEmail: 'test@test.com',
      userPhone: '0700000000',
      userCountry: '' }));
    req.end();

The above command returns JSON structured like this:

 {
      "_id": "6e7adfb9f56363518f370151"
 }

Add new prospect method

HTTP Request

POST {{base_url}}/api/prospect

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
avandorUserIdavandor user id
avandorSessionavandor session (can be sent as a JSON object using an application/json request type)
userFirstNameuser's first name
userLastNameuser's last name
companyNameuser's company name
companyTypeuser's company type
userCountryuser's country
userAddressuser's address
userPositionuser's position
userPhoneuser's phone
userEmailuser's email address
companyWebsiteuser's company website
potentialScoreuser's potential score

Update NPS

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/api/lead/{{lead_id}}/nps?access_token={{access_token}}")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Put.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "nps=10&comment%20=test"

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/lead/{{lead_id}}/nps?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "PUT",
      CURLOPT_POSTFIELDS => "nps=10&comment=test",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request PUT \
    --url 'http://{{base_url}}/api/lead/{{lead_id}}/nps?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'nps=10&comment%20=test'
   var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "PUT",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "lead",
        "{{lead_id}}",
        "nps"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ nps: '10', 'comment ': 'test' }));
    req.end();

The above command returns JSON structured like this:


{
  "status": "success"
}

Updates the NPS data for a lead.

HTTP Request

POST {{base_url}}/api/lead/{{lead_id}}/nps

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
nps number min:1, max: 10
comment string

Update Lost Lead

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/api/lead/{{lead_id}}/leadLost?access_token={{access_token}}")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Put.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "reasonLost=price_too_high&comment%20=test"

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/lead/{{lead_id}}/leadLost?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "PUT",
      CURLOPT_POSTFIELDS => "reasonLost=price_too_high&comment%20=test",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request PUT \
    --url 'http://{{base_url}}/api/lead/{{lead_id}}/leadLost?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'reasonLost=price_too_high&comment%20=test'
   var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "PUT",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "lead",
        "{{lead_id}}",
        "leadLost"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ reasonLost: 'price_too_high', 'comment ': 'test' }));
    req.end();

The above command returns JSON structured like this:


  {
    "_id": "5ebe9558aea45e10fc094c8b",
    "comments": "62b094763720b627e83324ef",
    "timestamp": "2020-03-15 16:12:56",
    "createdAt": "2020-03-15 16:12:56",
    "status": "lead",
    "userFirstName": "First Name",
    "userLastName": "Last Name",
    "userPhone": "0700000118",
    "userEmail": "test5557@test.com",
    "locationId": "5cf92039bc79te5cf99e3540",
    "offerId": "5cf92a83bc790a5cf99e35cf",
    "updatedAt": "2020-03-15 16:12:56",
    "consultantId": "59f8530f0et24a7c9247cuew7",
    "assignedBefore": 1,
    "skuId": "5e6b7be8576e5213f065b23c",
    "contractId": "5ebe97b8d6772218b0a76785",
    "skuExternalId": "12345"
  }

Updates the lost lead.

HTTP Request

PUT {{base_url}}/api/lead/{{lead_id}}/leadLost

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
reasonLost Reason for update Lost accepted values: poor_qualification,need,wrong_time,price_too_high,lost_momentum,competition,abandoned,feature,other
comment Comments

Customers

Get customers

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/client?access_token={{access_token}}&userEmail=test@test.ro&userPhone=0700000000")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    
    response = http.request(request)
    puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/client?access_token={{access_token}}&userEmail=test@test.ro&userPhone=0700000000",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request GET \
    --url 'http://{{base_url}}/api/client?access_token={{access_token}}&userEmail=test@test.ro&userPhone=0700000000' \
    --header 'Content-Type: application/x-www-form-urlencoded'
   var http = require("http");

    var options = {
      "method": "GET",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "client"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();

The above command returns JSON structured like this:

 {
      "_id": "5e7adfb9f583635122272a45",
      "userFirstName": "Test",
      "userLastName": "Test",
      "userEmail": "test@test.com",
      "userPhone": "0700000000",
      "timestamp": "2018-08-20T15:35:22.024Z",
      "createdAt": "2018-08-20T15:35:21.962Z",
      "type": "B2C",
      "__v": 2,
      "kidsAge": [],
      "interests": [],
      "preferences": [],
      "employees": [],
      "marketingChannels": [],
      "pointsOfPresence": [],
      "interactionsTimeline": [
          {
              "createdAt": "2018-08-20T15:35:22.024Z",
              "timestamp": "2018-08-20T15:35:22.024Z",
              "icon": "icon-location-city",
              "offlineCampaignId": null,
              "offerCategoryId": {
                  "applicationKeys": [],
                  "consultants": [],
                  "locations": [
                      "59f8385a65157484ba1d11d",
                      "55f838e128a157484ba1d230"
                  ],
                  "offers": [
                      {
                          "_id": "5a05eafff1fa75415cc21f7d",
                          "name": "Contests and prizes",
                          "description": "",
                          "price": "",
                          "offerCategoryId": "5a053cc5b425fe79a0a51254",
                          "userId": "59f855060e3f1a7c9247c4b1",
                          "timestamp": "2017-11-08T11:31:11.633Z",
                          "createdAt": "2017-11-08T11:31:11.633Z",
                          "__v": "0"
                      }
                  ],
                  "__v": 2,
                  "createdAt": "2017-11-06T10:43:17.124Z",
                  "timestamp": "2017-11-08T11:32:32.304Z",
                  "description": "",
                  "name": "Offline campaigns",
                  "_id": "5a103cc5b425fe79a0a41253"
              },
              "leadId": "5b7adfb9f58383518b332a46"
          }
      ],
      "personalAssistance": [],
      "leads": [
          {
              "history": [
                  {
                      "__v": 0,
                      "leadId": "5b7adfb9f58383518b332a46",
                      "userFirstName": "Test",
                      "userLastName": "Test",
                      "userEmail": "test@test.com",
                      "userPhone": "0700000000",
                      "offerCategoryId": "5a003cc5b425fe79a0a41254",
                      "status": "lead",
                      "applicationKey": "072f34176f42a855da5ff3b1",
                      "isMultipart": false,
                      "isComplete": true,
                      "timestamp": "2018-08-20T15:35:22.012Z",
                      "createdAt": "2018-08-20T15:35:22.012Z",
                      "_id": "5b7adfbaf58363518b372a47"
                  }
              ],
              "interactions": [],
              "comments": [],
              "kidsAge": [],
              "__v": 1,
              "type": "B2C",
              "actionRequired": true,
              "createdAt": "2018-08-20T15:35:21.973Z",
              "timestampStatusChange": "2018-08-20T15:35:21.973Z",
              "timestamp": "2018-08-20T15:35:21.973Z",
              "isComplete": true,
              "isMultipart": false,
              "offerCategory": {
                  "consultants": [],
                  "id": "5a003aa5b425aa79a0a41254"
              },
              "application": {
                  "name": "CRM Application",
                  "id": "67a6ff12cf74a7140931626c"
              },
              "applicationKey": "071f34176f42a143da5ff3b1",
              "status": "lead",
              "clientId": "5b7vvfb9f58363518b37r345",
              "offerCategoryId": "5a113cc5b425fe79a0a41254",
              "userPhone": "0700000000",
              "userEmail": "test@test.com",
              "userLastName": "Test",
              "userFirstName": "Test",
              "_id": "5b7adfb9f58363518b372a43",
              "channelId": "5a3e2bac8720349d675c97c9"
          }
      ]
  }

Get a profile based on customer's email and phone (mandatory fields) or customer's NationalId number

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/client

Query Parameters

Parameter Description
access_tokenaccess token
userEmailuser's email address
userPhoneuser's phone

Update customer

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/client?access_token={{access_token}}")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Put.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "userFirstName=Test&userLastName=Test&userEmail=test@test.ro&userPhone=0700000000"
    
    response = http.request(request)
    puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/client?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "PUT",
      CURLOPT_POSTFIELDS => "userFirstName=Test&userLastName=Test&userEmail=test@test.ro&userPhone=0700000000",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request PUT \
    --url 'http://{{base_url}}/api/client?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'userFirstName=Test&userLastName=Test&userEmail=test@test.ro&userPhone=0700000000'
   var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "PUT",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "client"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ userFirstName: 'Test',
      userLastName: 'Test',
      userEmail: 'test@test.ro',
      userPhone: '0700000000' }));
    req.end();

The above command returns JSON structured like this:

 {
    "status": "success"
 }

Update customer's data

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

PUT {{base_url}} /api/client

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
userFirstNameuser's first name
userLastNameuser's last name
nationalIduser's national Id
userEmailuser's email address
userPhoneuser's phone
userSexpossible values: male, female
userCityuser's city
userCountyuser's county
userCountryuser's country
userAddressuser's address
userFamilyDetalispossible values: "single","married"
userChildrenuser's number of children
userIndustryuser's industry
userCompanyNameuser's company
userCompanyAddressuser's company address
userJobuser's job
userJobDescriptionuser's job description
userBirthdayuser's birthday, accepted format Y-m-d
userExternalIduser's id from the primary database
facebookUrlFacebook user profile
imageUrluser profile picture
marketingChannelsarray containing objects like
channel ('sms', 'email', 'notification', 'dm', 'socialMedia'),
type ('owner', 'group', 'partners'),
agreed ("true", "false")
interestsarray de strings ['books', 'cars']
preferencesarray de strings ['books', 'cars']
customDetails
hasKidspossible values: "true", "false"
noOfKidsnumber of kids
kidsAgearray of numbers - Ex: [6, 14]
agreeTandcTerms & Conditions Agreement, possible values: "true", "false"
agreePrivacyPrivacy Policy Agreement, possible values: "true", "false"
agreedTargetedMessagesPersonalized Messages Agreement possible values: "true", "false"
isAdultpossible values: "true", "false"

Delete customer

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/api/client?access_token={{access_token}}")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Delete.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "userExternalId=2446456"

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/client?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "DELETE",
      CURLOPT_POSTFIELDS => "userExternalId=2446456",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request DELETE \
    --url 'http://{{base_url}}/api/client?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data userExternalId=2446456
    var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "DELETE",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "client"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ userExternalId: '2446456' }));
    req.end();

The above command returns JSON structured like this:

  {
    "status": "success"
  }

Delete customer's data

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

DELETE {{base_url}}/api/client

Query Parameters

Parameter Description
access_token access token

Loyalty Campaign Codes

Get Active Loyalty Campaigns

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/loyaltyCode/active-campaigns?access_token={{access_token}}")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    
    response = http.request(request)
    puts response.read_body
   $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => "http://{{base_url}}/api/loyaltyCode/active-campaigns?access_token={{access_token}}",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
      "Content-Type: application/x-www-form-urlencoded"
    ),
  ));
  
  $response = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  
  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
    curl --request GET \
    --url 'http://{{base_url}}/api/loyaltyCode/active-campaigns?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded'
  var http = require("http");

    var options = {
      "method": "GET",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "loyaltyCode",
        "active-campaigns"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();

The above command returns JSON structured like this:

  {
    "status": "success",
    "campaigns": [
        {
            "_id": "5bd2f3b6a651e40b280741ac",
            "internalId": "3irf2dmn8ks",
            "name": "Demo Campaign 2",
            "startDate": "2018-10-26T10:59:08.000Z",
            "endDate": "2018-12-26T10:59:08.000Z",
            "expireCodesDate": "2019-10-27T10:59:08.000Z",
            "loyaltySettings": {
                "loyaltyPrizeTypes": [
                    {
                        "name": "Prize 1"
                    },
                    {
                        "name": "Prize 2"
                    }
                ]
            },
            "location": {
                "name": "Mega Mall"
            },
            "total": 0
        },
        {
            "_id": "5ls6a8de1f4da126689eec44",
            "internalId": "i8inejs4t8c",
            "name": "Demo Campaign 4",
            "startDate": "2018-10-07T08:59:40.000Z",
            "endDate": "2018-11-30T08:59:40.000Z",
            "expireCodesDate": "2018-11-22T08:59:40.000Z",
            "loyaltySettings": {
                "loyaltyPrizeTypes": [
                    {
                        "name": "Prize 3"
                    }
                ]
            },
            "location": {
                "name": "Mega Mall"
            },
            "total": 1
        }
    ]
}

This method allows you to get the list with all active campaigns associated to the authenticated user

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/loyaltyCode/active-campaigns

Query Parameters

Parameter Description
access_token access token

Get Loyalty Campaigns

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/loyaltyCode/campaigns?access_token={{access_token}}")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/loyaltyCode/campaigns?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    curl --request GET \
    --url 'http://{{base_url}}/api/loyaltyCode/campaigns?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded'
   var http = require("http");

    var options = {
      "method": "GET",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "loyaltyCode",
        "campaigns"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end(); 

The above command returns JSON structured like this:

  {
    "status": "success",
    "campaigns": [
        {
            "_id": "5ss2f3b6a651736e40b280741ac",
            "internalId": "4ihf47mngkb",
            "name": "Campaign name",
            "type": "drive_loyalty",
            "budget": 0,
            "salesCost": null,
            "monthlySellingCost": null,
            "monthlyServicingCost": null,
            "productionCost": null,
            "profitabilityTime": null,
            "retentionRate": null,
            "landingPageURL": "",
            "startDate": "2018-10-26T10:59:08.000Z",
            "endDate": "2018-12-26T10:59:08.000Z",
            "expireCodesDate": "2019-10-27T10:59:08.000Z",
            "timestamp": "2018-10-26T11:00:06.633Z",
            "createdAt": "2018-10-26T11:00:06.633Z",
            "__v": 15,
            "locationId": "58d5385a68a157484ba1dw11",
            "loyaltySettings": {
                "type": "instant",
                "allowedChars": "",
                "codeLength": "9",
                "loyaltyPrizeTypes": [
                    {
                        "_id": "5cs8868d0880e32034d474d9",
                        "totalCodes": 22,
                        "pointsValue": 10,
                        "name": "Prize 1"
                    },
                    {
                        "_id": "5cs8968d0880e32034d474d8",
                        "totalCodes": 25,
                        "pointsValue": 20,
                        "name": "Prize 2"
                    }
                ]
            },
            "extraAllocations": [
                {
                    "type": "purchases",
                    "currency": "",
                    "criteria": "above",
                    "period": "",
                    "value": 120,
                    "betweenValue": null,
                    "loyaltyPoints": 10,
                    "customPeriod": 0,
                    "_id": "5ds2f3b6b651e42baaa941wq"
                }
            ],
            "leads": [],
            "total": 0
        }
    ]
}

This method allows you to get the list with all campaigns associated to the authenticated user

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/loyaltyCode/campaigns

Query Parameters

Parameter Description
access_token access token

Check Client Code

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/loyaltyCode/check?access_token={{access_token}}")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "userEmail=mihai%40popescu.com&userPhone=%2B075364628484&campaignInternalId=msyfms5a9sd2"
    
    response = http.request(request)
    puts response.read_body
   $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => "http://{{base_url}}/api/loyaltyCode/check?access_token={{access_token}}",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "userEmail=mihai%40popescu.com&userPhone=%2B075364628484&campaignInternalId=msyfms5a9sd2",
    CURLOPT_HTTPHEADER => array(
      "Content-Type: application/x-www-form-urlencoded"
    ),
  ));
  
  $response = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  
  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
    curl --request POST \
  --url 'http://{{base_url}}/api/loyaltyCode/check?access_token={{access_token}}' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'userEmail=mihai%40popescu.com&userPhone=%2B075364628484&campaignInternalId=msyfms5a9sd2'
   var qs = require("querystring");
  var http = require("http");
  
  var options = {
    "method": "POST",
    "hostname": [
      "{{base_url}}"
    ],
    "path": [
      "api",
      "loyaltyCode",
      "check"
    ],
    "headers": {
      "Content-Type": "application/x-www-form-urlencoded"
    }
  };
  
  var req = http.request(options, function (res) {
    var chunks = [];
  
    res.on("data", function (chunk) {
      chunks.push(chunk);
    });
  
    res.on("end", function () {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
    });
  });
  
  req.write(qs.stringify({ userEmail: 'mihai@popescu.com',
    userPhone: '+075364628484',
    campaignInternalId: 'msyfms5a9sd2' }));
  req.end();

The above command returns JSON structured like this:

  {
    "status": "success",
    "message": "redeem code found",
    "code": "9E58EDI",
    "expire_code_date": "2018-12-15 17:28:47",
    "prize_status": "associated", 
    "prize": {
          name: "Prize Name Example"
    }, 
    "last_update": "2018-11-21 15:48:14"
  }

This method allows you to check if a client has a code already allocated to a specific campaign

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/api/loyaltyCode/check

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
userEmail user's email address
userPhone user's phone
campaignInternalId campaign internal id

Change Code Status

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/loyaltyCode/change?access_token={{access_token}}")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "userEmail=mihai%40popescu.com&userPhone=%2B075364628484&campaignInternalId=msyfms5a9sd2&code=XFSTWK98HG"
    
    response = http.request(request)
    puts response.read_body
   $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => "http://{{base_url}}/api/loyaltyCode/change?access_token={{access_token}}",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "userEmail=mihai%40popescu.com&userPhone=%2B075364628484&campaignInternalId=msyfms5a9sd2&code=XFSTWK98HG",
    CURLOPT_HTTPHEADER => array(
      "Content-Type: application/x-www-form-urlencoded"
    ),
  ));
  
  $response = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  
  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
    curl --request POST \
  --url 'http://{{base_url}}/api/loyaltyCode/change?access_token={{access_token}}' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'userEmail=mihai%40popescu.com&userPhone=%2B075364628484&campaignInternalId=msyfms5a9sd2&code=XFSTWK98HG'
   var qs = require("querystring");
  var http = require("http");
  
  var options = {
    "method": "POST",
    "hostname": [
      "{{base_url}}"
    ],
    "path": [
      "api",
      "loyaltyCode",
      "change"
    ],
    "headers": {
      "Content-Type": "application/x-www-form-urlencoded"
    }
  };
  
  var req = http.request(options, function (res) {
    var chunks = [];
  
    res.on("data", function (chunk) {
      chunks.push(chunk);
    });
  
    res.on("end", function () {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
    });
  });
  
  req.write(qs.stringify({ userEmail: 'mihai@popescu.com',
    userPhone: '+075364628484',
    campaignInternalId: 'msyfms5a9sd2',
    code: 'XFSTWK98HG' }));
  req.end();

The above command returns JSON structured like this:

  {
    "status": "success"
  }

This method allows you to change a status code from allocated to redeemed/blocked

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/api/loyaltyCode/change

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
userEmail user's email address
userPhone user's phone
campaignInternalId campaign internal id
code the code to be redeemed/blocked

Code List

Use the access token obtained from authentication method:



    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/loyaltyCode/list?access_token={{access_token}}")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "campaignInternalId=e2h11c3its&searchTerm=&page=1"

  $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/loyaltyCode/list?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "campaignInternalId=e2h11c3its&searchTerm=&page=1",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }

   curl --request POST \
    --url 'http://{{base_url}}/api/loyaltyCode/list?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'campaignInternalId=e2h11c3its&searchTerm=&page=1'
   var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "loyaltyCode",
        "list"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ campaignInternalId: 'e2h11c3its', searchTerm: '', page: '1' }));
    req.end();

The above command returns JSON structured like this:

  {
  "status": "success",
  "clients": [
      {
          "code": "9X4C8DN6",
          "campaign": {
              "_id": "5cc5ef457c4c2154445fe9d2",
              "internalId": "e2h11c3its",
              "name": "Test 1",
              "type": "drive_loyalty",
              "startDate": "2018-10-01T13:38:39.000Z",
              "endDate": "2018-10-16T13:38:39.000Z",
              "loyaltySettings": {
                  "type": "standard"
              },
              "expireCodesDate": "2018-10-31T21:00:00.000Z"
          },
          "client": {
              "_id": "5ba4c44422206e61b1b8b515",
              "userFirstName": "Andrei",
              "userLastName": "Ionescu",
              "userEmail": "exemplu@test.com",
              "userPhone": "0700000000",
              "userAddress": ""
          },
          "status": "associated",
          "prize": {
              "pointsValue": 1,
              "name": "Prize number 1"
          },
          "hostess": {
              "_id": "5a0f3b91137e430dfc6795d7",
              "name": "Test Hostess"
          }
      }
  ],
  "totalResults": 1
} 

Get the paginated list with allocated,redeemed and blocked codes for one/all campaigns

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/api/loyaltyCode/list

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
campaignInternalId (optional) campaign internal id
searchTerm (optional) search in code field
page (optional) page number (if not specified the server will return the first page results)

Check Loyalty User Prize History

Use the access token obtained from authentication method:



    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/api/loyaltyCode/history?access_token={{access_token}}")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "userEmail=mihai%40popescu.com&userPhone=%2B075364625500"

    response = http.request(request)
    puts response.read_body

  $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/loyaltyCode/history?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "userEmail=mihai%40popescu.com&userPhone=%2B075364625500",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }

   curl --request POST \
    --url 'http://{{base_url}}/api/loyaltyCode/history?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'userEmail=mihai%40popescu.com&userPhone=%2B075364625500'
   var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "loyaltyCode",
        "history"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ userEmail: 'mihai@popescu.com', userPhone: '+075364625500' }));
    req.end();

The above command returns JSON structured like this:

  
    {
      "status": "success",
      "codes": [
          {
              "code": "JGFRZ328",
              "campaign": {
                  "internalId": "17ytx3n52qm",
                  "name": "Loyalty Test"
              },
              "status": "redeemed",
              "prize": {
                  "name": "Prize Name"
              },
              "location": {
                  "name": "Location name"
              },
              "expire_code_date": "2018-12-15T15:28:47.000Z",
              "last_update": "2018-11-28T09:26:00.726Z"
          }
      ]
  }

Get the prizes redeemed or associated to a specific user

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/api/loyaltyCode/history

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
userEmail user email
userPhone user phone

List Catalogues

Use the access token obtained from authentication method:

    require 'uri'
require 'net/http'

url = URI("http://{{base_url}}/api/offerCategory?access_token={{access_token}}")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/offerCategory?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request GET \
    --url 'http://{{base_url}}/api/offerCategory?access_token={{access_token}}'
   var http = require("http");

    var options = {
      "method": "GET",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "offerCategory"
      ],
      "headers": {}
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();

Response headers:

  
  {
    Access-Control-Expose-Headers : X-Total-Pages, X-Records, X-Current-Page
    X-Current-Page : 1
    X-Records : 2
    X-Total-Pages : 1
  }

Response body:

  
    [
      { 
        "_id": "5d7a3190e47bd328e45bd176",
        "name": "Catalog 1"
      },
      { 
        "_id": "5d7a3190e47bd328e45bd177",
        "name": "Catalog 2"
      }
    ]

List Catalogues

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/offerCategory

Query Parameters

Parameter Description
access_token access token
page page number

List offers

Use the access token obtained from authentication method:

    require 'uri'
require 'net/http'

url = URI("http://{{base_url}}/api/offer?access_token={{access_token}}&page=1")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/offer?access_token={{access_token}}&page=1",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request GET \
    --url 'http://{{base_url}}/api/offer?access_token={{access_token}}&page=1'
   var http = require("http");

    var options = {
      "method": "GET",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "offerCategory"
      ],
      "headers": {}
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();

Response headers:

  
  {
    Access-Control-Expose-Headers : X-Total-Pages, X-Records, X-Current-Page
    X-Current-Page : 1
    X-Records : 2
    X-Total-Pages : 1
  }

Response body:

  
    [
      {
          "_id": "5d7f8932387e93790a187b3b",
          "name": "Offer 1",
          "price": 250,
          "externalId": "GSFAR300", 
          "offerCategory": {
              "_id": "5cf92a83bc790a5cf99e34cd",
              "name": "Catalog 1"
          }
      },
      {
        "_id": "5d7f8932387e93790a187b3b",
        "name": "Offer 2",
        "price": 350, 
        "externalId": "GDTSR302",
        "offerCategory": {
            "_id": "5cf92a83bc790a5cf99e34cd",
            "name": "Catalog 1"
        }
      },
    ]

List Offers

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/offer

Query Parameters

Parameter Description
access_token access token
page page number

List SKUs

Use the access token obtained from authentication method:


require 'uri'
require 'net/http'

url = URI("http://{{base_url}}/api/sku?access_token={{access_token}}&page=1")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/sku?access_token={{access_token}}&page=1",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request GET \
    --url 'http://{{base_url}}/api/sku?access_token={{access_token}}&page=1'
   var http = require("http");

    var options = {
      "method": "GET",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "offerCategory"
      ],
      "headers": {}
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();

Response headers:

  
  {
    Access-Control-Expose-Headers : X-Total-Pages, X-Records, X-Current-Page
    X-Current-Page : 1
    X-Records : 2
    X-Total-Pages : 1
  }

Response body:

  
    [
      {
          "_id": "5e6b7be8576e5213f065b23c",
          "name": "PROD SKU 1",
          "price": 5534,
          "externalId": "RESH132",
          "quantity": 1,
          "offer": {
              "_id": "5cf92a83bc790a5cf99e35cf",
              "name": "Product 1"
          }
      },
      {
        "_id": "5d7f8932387e93790a187b38",
        "name": "PROD SKU 2",
        "price": 1132,
        "externalId": "TARS635",
        "quantity": 1,
        "offer": {
            "_id": "5cf92a83bc790a5cf99e35cd",
            "name": "Product 5"
        }
      },
    ]

List SKUs

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/sku

Query Parameters

Parameter Description
access_token access token
page page number

List Locations

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/api/location?access_token={{access_token}}&country_name={{country_name}}&county_name={{county_name}}")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/location?access_token={{access_token}}&country_name={{country_name}}&county_name={{county_name}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request GET \
    --url 'http://{{base_url}}/api/location?access_token={{access_token}}&country_name={{country_name}}&county_name={{county_name}}' \
    --header 'Content-Type: application/x-www-form-urlencoded'
   var http = require("http");

    var options = {
      "method": "GET",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "location"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();

The above command returns JSON structured like this:


    [{
        "_id": "5b887473a504503c31559108",
        "timestamp": "2018-08-07T10:29:07.932Z",
        "createdAt": "2018-08-07T10:29:07.932Z",
        "areaId": "5b697473a504503c31299107",
        "name": "Sucursala Test", 
        "description": "17:00-19:00",
        "address": "Alba Iulia, Str. Test nr.1",
        "__v": 1,
        "coords": [
            0,
            0
        ],
        "image": ""
    }]

Lists bussiness locations

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/location

Query Parameters

Parameter Description
access_token Access token
country_name Country name (Optional)
county_name County name (Optional)

List Offline Campaigns

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/api/offlineCampaign?access_token={{access_token}}")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/offlineCampaign?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
   curl --request GET \
    --url 'http://{{base_url}}/api/offlineCampaign?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded'
   var http = require("http");

    var options = {
      "method": "GET",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "offlineCampaign"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();

The above command returns JSON structured like this:


    [{
        "_id": "5b30cb8ae1267446c1554b6c",
        "locationId": "5b02c891f7fb282c3a8f34b9",
        "name": "Offline Campanign Test",
        "description": "",
        "image": null,
        "type": "offline",
        "budget": 0,
        "startDate": "2018-06-25T11:00:18.000Z",
        "endDate": "2018-11-30T11:00:18.000Z",
        "timestamp": "2018-06-25T11:00:58.546Z",
        "createdAt": "2018-06-25T11:00:58.546Z",
        "drawFrequency": {
            "repeats": "none",
            "frequency": null,
            "day": null,
            "end": {
                "type": "",
                "value": ""
            }
        },
        "winningType": [],
        "__v": 0
    }]

List Offline Campaigns

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/offlineCampaign

Query Parameters

Parameter Description
access_token access token

List Business Users

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/api/business-users?access_token={{access_token}}")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/business-users?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
   curl --request GET \
    --url 'http://{{base_url}}/api/business-users?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded'
   var http = require("http");

    var options = {
      "method": "GET",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "business-users"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();

The above command returns JSON structured like this:


    [{
      "_id": "5ff16u391c21fa85wfad5278",
      "locations": [
          {
              "_id": "5d53b911441c3a7890b5212c",
              "name": "Location 1"
          },
          {
              "_id": "5b4b3b4598721d409592201a",
              "name": "Location 2"
          }
      ],
      "offerCategories": [
          {
              "_id": "5dae1ff557a2dg03f7799c9a",
              "name": "Category 1"
          },
          {
              "_id": "5df03c10cec8576c0fc1e46d",
              "name": "Category 2"
          }
      ],
      "firstName": "User Last Name",
      "lastName": "User First Name",
      "email": "user.email@test.com",
      "phone": "0000000000",
      "groupRole": "sales",
      "role": "consultant"
  }]

List Business Users

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/business-users

Query Parameters

Parameter Description
access_token access token

List Channels

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/api/channels?access_token={{access_token}}")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/channels?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));
   curl --request GET \
    --url 'http://{{base_url}}/api/channels?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded'
   var http = require("http");

    var options = {
      "method": "GET",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "channels"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();

The above command returns JSON structured like this:


    [{
      "_id": "5d72559ea51b651623b1ac8b",
      "name": "Channel 1",
      "mediaType": "Earned Media"
    },
    {
      "_id": "7d72339ea51b651648b1a4a2",
      "name": "Channel 2",
      "mediaType": "Owned Media"
    }]

List Channels

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

GET {{base_url}}/api/channels

Query Parameters

Parameter Description
access_token access token

Send Notifications

Use the access token obtained from authentication method:


    require 'uri'
    require 'net/http'
    
    url = URI("http://{{base_url}}/api/notifications/send?access_token={{access_token}}")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "templateKey=irqm1350re7pw&email=test@test.com&attachmentFileName=test.pdf&attachmentFileContent=JVBERi0xLjQNJeLjz9M..."
    
    response = http.request(request)
    puts response.read_body

    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "http://{{base_url}}/api/notifications/send?access_token={{access_token}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "templateKey=irqm1350re7pw&email=test@test.com&attachmentFileName=test.pdf&attachmentFileContent=JVBERi0xLjQNJeLjz9M...",
      CURLOPT_HTTPHEADER => array(
        "Content-Type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
   curl --request POST \
    --url 'http://{{base_url}}/api/notifications/send?access_token={{access_token}}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'templateKey=irqm1350re7pw&email=test@test.com&attachmentFileName=test.pdf&attachmentFileContent=JVBERi0xLjQNJeLjz9M...'
   var qs = require("querystring");
    var http = require("http");
    
    var options = { 
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "api",
        "notifications",
        "send"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ templateKey: 'irqm1350re7pw',
      email: 'test@test.com',
      attachmentFileName: 'test.pdf',
      attachmentFileContent: 'JVBERi0xLjQNJeLjz9M...' }));
    req.end();

The above command returns JSON structured like this:

 {
  "status": "success",
  "message": "Message sent!"
}

Send email notifications

HTTP Request

POST {{base_url}}/api/notifications/send

Query Parameters

Parameter Description
access_token access token

Body

Parameter Description
templateKeytemplate key
emailuser email address
firstNameuser's first name
lastNameuser's last name
attachmentFileNameattachment filename
attachmentFileContentattachment file content (base64 encoded); file types allowed - pdf

Web Data Tracking

Initialize web tracking session


    require 'uri'
  require 'net/http'

  url = URI("http://{{base_url}}/jsapi/init")

  http = Net::HTTP.new(url.host, url.port)

  request = Net::HTTP::Post.new(url)
  request["Content-Type"] = 'application/x-www-form-urlencoded'
  request.body = "appkey=571e64183647a855d0sgf3a3&email=test.email%40test.com"

  response = http.request(request)
  puts response.read_body
   $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => "http://{{base_url}}/jsapi/init",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "appkey=571e64183647a855d0sgf3a3&email=test.email%40test.com",
    CURLOPT_HTTPHEADER => array(
      "Content-Type: application/x-www-form-urlencoded"
    ),
  ));
  
  $response = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  
  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
    curl --request POST \
    --url 'http://{{base_url}}/jsapi/init' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'appkey=571e64183647a855d0sgf3a3&email=test.email%40test.com'
  var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "jsapi",
        "init"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ appkey: '571e64183647a855d0sgf3a3',
      email: 'test.email%40test.com' }));
    req.end();

The above command returns JSON structured like this:

  
{
    "status": "ok",
    "pid": "b38efdc7087731bbef9d6cb050a6aa9bbcb8beb2178ec42afac83eb5e836f050"
}

This method initializes the web tracking session for a specific user. In a successful response you'll get an uid value (when the user was identified in our database) or a pid value for a NOT identified user. You can use this value in the next method for sending tracking data.

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/jsapi/init

Body

Parameter Description
appkey application key
email user's email address
technicalInfo[screenSize] screen size (widthxheight), string format
technicalInfo[browserUserAgent] browserUserAgent data; ex: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
technicalInfo[browserType] browser type; ex: Chrome
technicalInfo[appId] iTunes ID / Google Play ID
technicalInfo[deviceOs] device operating system (Windows, Android, iOS ...)

Send web tracking data

Use the value obtained from "Initialize tracking session" method in the uid/pid field:


    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/jsapi/send")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "appkey=571e64183647a855d0sgf3a3&uid=a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667&uType=c&actionType=visit&requestType=action&aditionalData%5Bbrands%5D%5B0%5D=Zara&aditionalData%5Bbrands%5D%5B1%5D=Adidas&aditionalData%5Btenants%5D%5B0%5D=H%26M&aditionalData%5Btenants%5D%5B1%5D=C%26A"

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => "http://{{base_url}}/jsapi/send",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "appkey=571e64183647a855d0sgf3a3&uid=a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667&uType=c&actionType=visit&requestType=action&aditionalData%5Bbrands%5D%5B0%5D=Zara&aditionalData%5Bbrands%5D%5B1%5D=Adidas&aditionalData%5Btenants%5D%5B0%5D=H%26M&aditionalData%5Btenants%5D%5B1%5D=C%26A",
    CURLOPT_HTTPHEADER => array(
      "Content-Type: application/x-www-form-urlencoded"
    ),
  ));
  
  $response = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  
  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
    curl --request POST \
    --url 'http://{{base_url}}/jsapi/send' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'appkey=571e64183647a855d0sgf3a3&uid=a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667&uType=c&actionType=visit&requestType=action&aditionalData%5Bbrands%5D%5B0%5D=Zara&aditionalData%5Bbrands%5D%5B1%5D=Adidas&aditionalData%5Btenants%5D%5B0%5D=H%26M&aditionalData%5Btenants%5D%5B1%5D=C%26A'
  
  var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "jsapi",
        "send"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ appkey: '571e64183647a855d0sgf3a3',
      uid: 'a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667',
      uType: 'c',
      actionType: 'visit',
      requestType: 'action',
      'aditionalData[brands][0]': 'Zara',
      'aditionalData[brands][1]': 'Adidas',
      'aditionalData[tenants][0]': 'H&M',
      'aditionalData[tenants][1]': 'C&A' }));
    req.end();

The above command returns JSON structured like this:

  {}

This method sends the tracking data for a specific user

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/jsapi/send

Body

Parameter Description
appkey application key
uid use the value obtained in Initialize tracking session method (uid/pid value)
uType accepted values: p,c (uType is p if Initialize tracking session returned pid value, uType is c if Initialize tracking session returned uid value)
actionType accepted values: visit,sale,contact,feedback,engagement,profiling
requestType accepted values: action
aditionalData[brands] array with brand names ex: [Zara, Adidas, C&A]; this aditional data should be used only when request type is 'visit'
aditionalData[tenants] array with tenants ex: [H&M]; this aditional data should be used only when request type is 'visit'
aditionalData[interests] array with interests ex: [Beverages,Food]; this aditional data should be used only when request type is 'visit'
aditionalData[receipts] array with receipts; receipt format [name => "tenant name", value=> amount] ex: aditionalData[receipts] = [[name => "C&A",value => 52], [name => "Adidas",value => 322]]; this aditional data should be used only when request type is 'sale'
aditionalData[rating] rating value; a number between 1-10; this aditional data should be used only when request type is 'feedback'
aditionalData[appointmentDate] appointment date; date format YYYY-MM-DD HH:ii:ss; this aditional data should be used only when request type is 'contact'
aditionalData[senderType] accepted values: person,organization; this aditional data should be used only when request type is 'contact'
aditionalData[percentCompleted] profile completion percentage (without "%" symbol); values between 0-100; this aditional data should be used only when request type is 'profiling'
aditionalData[description] string; this aditional data should be used only when request type is 'engagement'

Mobile Data Tracking

Mobile Initialize tracking session


  require 'uri'
  require 'net/http'

  url = URI("http://{{base_url}}/mobileapi/init")

  http = Net::HTTP.new(url.host, url.port)

  request = Net::HTTP::Post.new(url)
  request["Content-Type"] = 'application/x-www-form-urlencoded'
  request.body = "appkey=571e64183647a855d0sgf3a3&userEmail=test.email%40test.com"

  response = http.request(request)
  puts response.read_body
   $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => "http://{{base_url}}/mobileapi/init",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "appkey=571e64183647a855d0sgf3a3&userEmail=test.email%40test.com&pushNotificationToken=123456",
    CURLOPT_HTTPHEADER => array(
      "Content-Type: application/x-www-form-urlencoded"
    ),
  ));
  
  $response = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  
  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
    curl --request POST \
    --url 'http://{{base_url}}/mobileapi/init' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'appkey=571e64183647a855d0sgf3a3&userEmail=test.email%40test.com&pushNotificationToken=123456'
  var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "mobileapi",
        "init"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ appkey: '571e64183647a855d0sgf3a3',
        userEmail: 'test.email%40test.com', pushNotificationToken: 123456 }));
    req.end();

The above command returns JSON structured like this:

  
{
    "status": "ok",
    "mobileId": "b38efdc7087731bbef9d6cb050a6aa9bbcb8beb2178ec42afac83eb5e836f050"
}

This method initializes the mobile tracking session for a specific user. In a successful response you'll get an uid value (when the user was identified in our database) or a pid value for a NOT identified user. You can use this value in the next method for sending tracking data.

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/mobileapi/init

Body

Parameter Description
appkey application key
userEmail user's email address
userPhone user's phone
pushNotificationToken push notification token
technicalInfo[screenSize] screen size (widthxheight), string format
technicalInfo[browserUserAgent] browserUserAgent data; ex: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
technicalInfo[browserType] browser type; ex: Chrome
technicalInfo[appId] iTunes ID / Google Play ID
technicalInfo[deviceOs] device operating system (Windows, Android, iOS ...)

Send mobile tracking screenview

Use the value obtained from "Initialize mobile tracking session" method in the mobileId field:


    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/mobileapi/send")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "appkey=571e64183647a855d0sgf3a3&mid=a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667&actionType=visit&requestType=action&aditionalData%5Bbrands%5D%5B0%5D=Zara&aditionalData%5Bbrands%5D%5B1%5D=Adidas&aditionalData%5Btenants%5D%5B0%5D=H%26M&aditionalData%5Btenants%5D%5B1%5D=C%26A"

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => "http://{{base_url}}/mobileapi/send",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "appkey=571e64183647a855d0sgf3a3&mid=a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667&actionType=visit&requestType=action&aditionalData%5Bbrands%5D%5B0%5D=Zara&aditionalData%5Bbrands%5D%5B1%5D=Adidas&aditionalData%5Btenants%5D%5B0%5D=H%26M&aditionalData%5Btenants%5D%5B1%5D=C%26A",
    CURLOPT_HTTPHEADER => array(
      "Content-Type: application/x-www-form-urlencoded"
    ),
  ));
  
  $response = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  
  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
    curl --request POST \
    --url 'http://{{base_url}}/mobileapi/send' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'appkey=571e64183647a855d0sgf3a3&mid=a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667&actionType=visit&requestType=action&aditionalData%5Bbrands%5D%5B0%5D=Zara&aditionalData%5Bbrands%5D%5B1%5D=Adidas&aditionalData%5Btenants%5D%5B0%5D=H%26M&aditionalData%5Btenants%5D%5B1%5D=C%26A'
  
  var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "POST",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "mobileapi",
        "send"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ appkey: '571e64183647a855d0sgf3a3',
      mid: 'a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667',
      actionType: 'visit',
      requestType: 'action',
      'aditionalData[brands][0]': 'Zara',
      'aditionalData[brands][1]': 'Adidas',
      'aditionalData[tenants][0]': 'H&M',
      'aditionalData[tenants][1]': 'C&A' }));
    req.end();

The above command returns JSON structured like this:

  {}

This method sends the tracking data for a specific user

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/mobileapi/send

Body

Parameter Description
appkey application key
mid use the value obtained in Initialize tracking session method (mobileId value)
actionType accepted values: visit,sale,contact,feedback,engagement,profiling
requestType accepted values: action
aditionalData[brands] array with brand names ex: [Zara, Adidas, C&A]; this aditional data should be used only when request type is 'visit'
aditionalData[tenants] array with tenants ex: [H&M]; this aditional data should be used only when request type is 'visit'
aditionalData[interests] array with interests ex: [Beverages,Food]; this aditional data should be used only when request type is 'visit'
aditionalData[receipts] array with receipts; receipt format [name => "tenant name", value=> amount] ex: aditionalData[receipts] = [[name => "C&A",value => 52], [name => "Adidas",value => 322]]; this aditional data should be used only when request type is 'sale'
aditionalData[rating] rating value; a number between 1-10; this aditional data should be used only when request type is 'feedback'
aditionalData[appointmentDate] appointment date; date format YYYY-MM-DD HH:ii:ss; this aditional data should be used only when request type is 'contact'
aditionalData[senderType] accepted values: person,organization; this aditional data should be used only when request type is 'contact'
aditionalData[percentCompleted] profile completion percentage (without "%" symbol); values between 0-100; this aditional data should be used only when request type is 'profiling'
aditionalData[description] string; this aditional data should be used only when request type is 'engagement'

Send mobile tracking sensors

Use the value obtained from "Initialize mobile tracking session" method in the mobileId field:


    require 'uri'
    require 'net/http'

    url = URI("http://{{base_url}}/mobileapi/sensors")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/x-www-form-urlencoded'
    request.body = "appkey=571e64183647a855d0sgf3a3&mid=a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667&actionType=visit&requestType=action&aditionalData%5Bbrands%5D%5B0%5D=Zara&aditionalData%5Bbrands%5D%5B1%5D=Adidas&aditionalData%5Btenants%5D%5B0%5D=H%26M&aditionalData%5Btenants%5D%5B1%5D=C%26A"

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => "{{base_url}}/mobileapi/sensors",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_POSTFIELDS => "appkey={{username}}&mid=p93eeea7322fed62b9b240d613b6c925b1cf125aed3bf030c64d8a51b35981c73&sensors%5B0%5D%5Buuid%5D=2376-34342-1233-23424&sensors%5B0%5D%5Brssi%5D=5&sensors%5B0%5D%5Bdistance%5D=4&sensors%5B0%5D%5BmacAddress%5D=345987345345-23482746-345934587&sensors%5B0%5D%5BtxPower%5D=2&sensors%5B0%5D%5Bname%5D=mimi&sensors%5B0%5D%5Bminor%5D=3.2&sensors%5B0%5D%5Bmajor%5D=4.1&sensors%5B1%5D%5Buuid%5D=2376-34342-1233-23422&sensors%5B1%5D%5Brssi%5D=5&sensors%5B1%5D%5Bdistance%5D=44&sensors%5B1%5D%5BmacAddress%5D=345987345345-23482746-345934587&sensors%5B1%5D%5BtxPower%5D=6&sensors%5B1%5D%5Bname%5D=cici&sensors%5B1%5D%5Bminor%5D=1.1&sensors%5B1%5D%5Bmajor%5D=2.2",
    CURLOPT_HTTPHEADER => array(
      "Content-Type: application/x-www-form-urlencoded"
    ),
  ));
  
  $response = curl_exec($curl);
  $err = curl_error($curl);
  
  curl_close($curl);
  
  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
    curl --request PUT \
    --url 'http://{{base_url}}/mobileapi/sensors' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data 'appkey=571e64183647a855d0sgf3a3&mid=a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667&sensors%5B0%5D%5Buuid%5D=2376-34342-1233-23424&sensors%5B0%5D%5Brssi%5D=5&sensors%5B0%5D%5Bdistance%5D=4&sensors%5B0%5D%5BmacAddress%5D=345987345345-23482746-345934587&sensors%5B0%5D%5BtxPower%5D=2&sensors%5B0%5D%5Bname%5D=mimi&sensors%5B0%5D%5Bminor%5D=3.2&sensors%5B0%5D%5Bmajor%5D=4.1&sensors%5B1%5D%5Buuid%5D=2376-34342-1233-23422&sensors%5B1%5D%5Brssi%5D=5&sensors%5B1%5D%5Bdistance%5D=44&sensors%5B1%5D%5BmacAddress%5D=345987345345-23482746-345934587&sensors%5B1%5D%5BtxPower%5D=6&sensors%5B1%5D%5Bname%5D=cici&sensors%5B1%5D%5Bminor%5D=1.1&sensors%5B1%5D%5Bmajor%5D=2.2'
  
  var qs = require("querystring");
    var http = require("http");
    
    var options = {
      "method": "PUT",
      "hostname": [
        "{{base_url}}"
      ],
      "path": [
        "mobileapi",
        "sensors"
      ],
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(qs.stringify({ appkey: '571e64183647a855d0sgf3a3',
      mid: 'a5c2dd6ebhsgtdr4ca6142a42910a972fecc71aa32ea88a0c681f77395bc218667',
      'sensors[uuid][0]': '4457-7784-5577-6655',
      'sensors[rssi][0]': '5461567',
      'sensors[distance][0]': 22,
      'sensors[txPower][0]': 568,
      'sensors[name][0]': 'Sensor1',
      'sensors[minor][0]': 10.2,
      'sensors[major][0]': 22.3,
      'sensors[macAddress][0]': '00-14-22-01-23-45' }));
    req.end();

The above command returns JSON structured like this:

  {
    "success": true
}

This method sends the tracking data for a group of sensors (beacons)

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/mobileapi/sensors

Body

Parameter Description
appkey application key
mid use the value obtained in Initialize tracking session method (mobileId value)
sensors[x][uuid] sensor specific attribute
sensors[x][rssi] sensor specific attribute
sensors[x][distance] sensor specific attribute
sensors[x][macAddress] user macAddress
sensors[x][txPower] sensor specific attribute
sensors[x][name] sensor specific attribute
sensors[x][minor] sensor specific attribute
sensors[x][major] sensor specific attribute

Send mobile tracking geolocation

Use the value obtained from "Initialize mobile tracking session" method in the mobileId field:


    require "uri"
    require "net/http"

    url = URI("{{base_url}}/mobileapi/geo")

    http = Net::HTTP.new(url.host, url.port)

    request = Net::HTTP::Put.new(url)
    request["Content-Type"] = "application/x-www-form-urlencoded"
    request.body = "appkey={{username}}&mid=p93eeea7322fed62b9b240d613b6c925b1cf125aed3bf030c64d8a51b35981c73&lat=44.432149&lon=26.088868&accuracy=3"

    response = http.request(request)
    puts response.read_body
   $curl = curl_init();
  
  $curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "{{base_url}}/mobileapi/geo",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => false,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "appkey={{username}}&mid=p93eeea7322fed62b9b240d613b6c925b1cf125aed3bf030c64d8a51b35981c73&lat=44.432149&lon=26.088868&accuracy=3",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/x-www-form-urlencoded"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
    curl --location --request PUT "{{base_url}}/mobileapi/geo" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "appkey={{username}}&mid=p93eeea7322fed62b9b240d613b6c925b1cf125aed3bf030c64d8a51b35981c73&lat=44.432149&lon=26.088868&accuracy=3"
  
  
  
  var qs = require("querystring");
  var https = require('https');

  var qs = require('querystring');
  
  var options = {
    'method': 'PUT',
    'hostname': '{{base_url}}',
    'path': '/mobileapi/geo',
    'headers': {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  };
  
  var req = https.request(options, function (res) {
    var chunks = [];
  
    res.on("data", function (chunk) {
      chunks.push(chunk);
    });
  
    res.on("end", function (chunk) {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
    });
  
    res.on("error", function (error) {
      console.error(error);
    });
  });
  
  var postData = qs.stringify({
    'appkey': '{{username}}',
    'mid': 'p93eeea7322fed62b9b240d613b6c925b1cf125aed3bf030c64d8a51b35981c73',
    'lat': '44.432149',
    'lon': '26.088868',
    'accuracy': '3'
  });
  
  req.write(postData);
  
  req.end();

The above command returns JSON structured like this:

  {
    "success": true
}

This method sends geolocation data

Headers

Content-Type application/x-www-form-urlencoded

HTTP Request

POST {{base_url}}/mobileapi/sensors

Body

Parameter Description
appkey application key
mid use the value obtained in Initialize tracking session method (mobileId value)
lat latitude
lon longitude
accuracy accuracy

JavaScript library

Initialize JavaScript tracking SDK

Integrate this Code:



  // You will need to use your App Key and integrate the following script into the section of the new data source

  <script> 
    (function (d, s, id) {

      var js, ojs = d.getElementsByTagName(s)[0];

      if (d.getElementById(id))
            {return;} 
        js = d.createElement(s); js.id = id; js.async=!0; 
        js.src ="{{base_url}}/jsapi/omnichannel.js";
        ojs.parentNode.insertBefore(js, ojs); 

    } (document, 'script', 'omnichanneltrack'));
  </script>

    // You will need to add the following JavaScript code snippet before closing the section of the new data source:

    <script>
      (function (d, s, id) { 

        var js, ojs = d.getElementsByTagName(s)[0]; 

        if (d.getElementById(id)) 
              {return;} 

        js = d.createElement(s); js.id = id; js.async=!0; 
        js.src ="{{base_url}}/jsapi/omnichannel.js";
        ojs.parentNode.insertBefore(js, ojs);
        } (document, 'script', 'omnichanneltrack'));
    </script>

The above command returns JSON structured like this:

  

Our JavaScript tracking code is capable to cover any types of data your project might generate and could benefit the purpose for which Footprints is used in your organization. Like what is the medium your user is coming from, what is a specific user doing onto your digital property, how they engage with various elements of your digital property or collecting and validating any data that the user would fill in any form.

The following tracking code must be implemented in the source code of each of the beneficiaries properties.

Step 1

For each individual data source (digital property) a data source must be configured by going into Settings > Data Sources > Create New Data Source. By doing so, you will be able to create an active source of data for your application and get the necessary credentials for further integrations (the App Key and the App Secret would be generated at this stage).

Step 2

You will need to use your App Key and integrate the following script into the section of the new data source

<script>
var ochnkey='<key>';
function ochntrack() {
ochn.init();
}</script>

Step 3

You will need to add the following JavaScript code snippet before closing the section of the new data source:

<script>
(function (d, s, id) {
var js, ojs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id; js.async=!0;
js.src ="{{base_url}}/jsapi/omnichannel.js"; ojs.parentNode.insertBefore(js, ojs);
} (document, 'script', 'omnichanneltrack'));
</script>

Setup guidelines



 
 

 


ochnkey is represented by the App Key for the corresponding data source (declared in Footprints > Account Settings > Data Sources). Both, the js ochntrack() function and the call code for the omnichannel.js file will be declared in all the pages.

• Inside the ontrack () function we have the method for initializing the tracking instance ochn.init (present on all pages) It can be accessed simply by ochn.init () in case the user is not logged in or ochn.init ('example@test.com') for the logged in user. Sending information regarding the newly accessed page is done through ochn.send ('action','visit', <object_date_additional>)