
www.footfallcam.com API Documentation
USER MANUAL
For FootfallCam 3D Plus

www.footfallcam.com API Documentation
1.0 Overview
2.0 Export Footfall Data to Retailer System
2.1 Pull Data via API
2.2 Pull Data from Central Database
2.3 Pull Data from FTP Server
2.4 Download CSV from FootfallCam Portal
3.0 Import Data from Retailer System
3.1 Push Data via API
3.1.1 ePOS Data
3.1.2 Staff Labour Hours
3.2 Push Data to FTP Server

www.footfallcam.com API Documentation
1.0 Overview
FootfallCam is a fully embedded software module, intended for any environment where store footfall counting is required. Business
intelligence (BI) system extracts and analyses footfall data (from FootfallCam central server) together with ePOS data or staff labour hours
(from retailer’s ePOS system or staff management system) to produce management report for corporate strategic planning.
There are several ways of integrating footfall data with the ePOS data or staff labour hours:
Export footfall data to retailer system
Import ePOS data or staff labour hours to FootfallCam central server
2.0 Export Footfall Data to Retailer System
2.1 Pull Data via API
The camera automatically collects the traffic data and builds them into a convenient JSON/XML data file that can be retrieved easily via a web
service API call, hence allowing seamless integration of the camera into any existing solution. Through an API call, the data file will be
extracted from FootfallCam portal to the business intelligence system for further data processing in order to generate the management report.
Get Counting Data
Description: API Function to receive counting data.
Counting data includes Timestamp, number of In count per 15 minutes, number of Out count per 15 minutes
http://<ip to counter>:<port>/pi-cgi/data.json (JSON Format)
http://<ip to counter>:<port>/pi-cgi/data.xml (XML Format)

www.footfallcam.com API Documentation
omit
Single day - <YYYYMMDD>
Date range –
<YYYYMMDD>-<YYYYMMDD>
omit – The current day data
Single day – Data on the
specified day
Date range – Data on the
specified data range, both
starting and ending is inclusive
Example:
Content: {
"cameraData": {
"companyCode": "<Company Code>",
"cameraName": "<Counter Name>",
"offset": <offset>
},
"data": [
{
"timestamp": <timestamp>,
"inCount": <valuein>,
"outCount": <valueout>
}]
}
<?xml version=”1.0” ?>
<count data>
Where <count data> is
<countdata version="2">
<count set>
</countdata>
<typedesc> is description of count type, where 3 represent In, and 4 represent Out.
<typedesc>
<type typeid="3">Pedestrian coming in</type>
<type typeid="4">Pedestrian going out</type>
</typedesc>
and <count set> is
<cntset name="<Company Code> - <Counter Name>" starttime="<start time>" delta="<delta>">
<count group>
</cntset>

www.footfallcam.com API Documentation
<start time> is POSIX format (seconds since 00:00:00 UTC, January 1, 1970) for the day
<delta> is the time interval specified in seconds between each entry and <count group> is
<cntgroup endtime="<end time>">
<cnt typeid="3"><valuein></cnt>
<cnt typeid="4"><valueout></cnt>
</cntgroup>
curl http://<ip to counter>:<port>/pi-cgi/data.json?date=20140101-20140131
2.2 Pull Data from Central Database
Instead of using API, users may choose to extract the footfall data directly from FootfallCam Central Database. This involves establishing a
remote connection directly to the database to extract the data from the relevant table to the business intelligence system.
Get Branch List
Description: SQL Function to retrieve branch list.
Branch data include Branch Id, Name, Region, City, Country, StoreType, Latitude, Longitude and Floor Size
Username [nvarchar]
Password [nvarchar]
SELECT * FROM GetBranchList('username','password');

www.footfallcam.com API Documentation
Get Counter By Branch
Description: SQL Function to retrieve counters filtered by branch.
Counter data include Counter Id, Name, IP, Port, Serial
Username [nvarchar]
Password [nvarchar]
BranchId [bigint]
SELECT * FROM GetCounterByBranch('username', 'password', 37);
Get Counter Counting
Description: SQL Function to retrieve counting filtered by counter.
Counting data include Counter (in hourly interval), ValueDateTime, ValueIn, ValueOut, OutsideTraffic, Day,
CounterId
Username [nvarchar]
Password [nvarchar]
CounterId [bigint]
StartDate [datetime]
EndDate [datetime]
SELECT * FROM GetCounterCounting('username', 'password', 410, '2015-03-20 00:00:00', '2015-03-20
23:59:59');

www.footfallcam.com API Documentation
Get Counter Daily Summary
Description: SQL Function to retrieve daily summary filtered by counter
Counting data include Date (POSIX Timestamp), CameraName, ValueIn, ValueOut, OutsideTraffic,
TurnInRate, LessThanFifteen, LessThanThiry, OverThirty, NewCustomer, ReturnInWeek, ReturnInMonth,
CounterId
Username [nvarchar]
Password [nvarchar]
CounterId [bigint]
StartDate [bigint] (POSIX Timestamp)
EndDate [bigint] (POSIX Timestamp)
Success Response
Sample Call
SELECT * FROM GetCounterDailySummary('username', 'password', 410, 1426809600, 1426896001);
2.3 Push to FTP Server
A dedicated FTP server will be provided by retailer as a ‘shared folder’ where access (link, username and password) will be given to
FootfallCam technical team to dump the footfall data (.csv files) into it. These data will then being retrieved from the FTP Server to the
business intelligence system for further data processing to generate the management report.

www.footfallcam.com API Documentation
2.4 Download CSV from FootfallCam Portal
Footfall data will be stored and updated to central server every 15 minutes automatically. Retailer will be given access (link, username and
password) to access FootfallCam portal to access these data and download it in .csv, PDF format, etc.
CSV Sample Data
3.0 Import Data from Retailer System
3.1 Push Data via API
Through an API call, retailer system sends a http request (containing ePOS data, staff labour hours, etc.) to FootfallCam central server.
FootfallCam central server returns a status to retailer’s system, indicating if the request is successful or fail. The data received from retailer’s
system will be further processed to integrate with the footfall data and generate reports in FootfallCam portal.
3.1.1 ePOS Data
PostTransaction
Description: API Function to receive Transaction data.
Transaction data including timestamp, number of transaction per 15 minutes, average amount per 15
minutes.
Each data entry must be in 15 minutes interval.
http://footfallcounter.com/api/Action/PostTransaction

www.footfallcam.com API Documentation
SecretKey : [String] Secret key provided by footfallcam for authentication purpose.
Data: Array of data entries as below:
Example:
{
SecretKey : “0E6A48F765D0FFFFF6247FA80D748E615F91DD0C7431E4D9”,
Data : [{
Timestamp : 1418688000,
TransactionCount : 10,
AverageAmount : 500.00
},
{
Timestamp : 1418688900,
TransactionCount : 8,
AverageAmount : 420.00
},
{
Timestamp : 1418689800,
TransactionCount : 14,
AverageAmount : 530.00
}]
}
Example:
Code: 200
Content: { Response: “OK” }
Example:
Code: 401 UNAUTHORIZED
Content: { error : " UNAUTHORIZED " }
OR
Code: 422 Unprocessable Entry
Content: { error : "Invalid Structure" }
$.ajax({
url: "http://controlpanel.retailcam.co.uk/api/Action/PostTransaction",
dataType: "json",
data : {
SecretKey : “0E6A48F765D0FFFFF6247FA80D748E615F91DD0C7431E4D9”,
Data : [{
Timestamp : 1418688000,
TransactionCount : 10,
AverageAmount : 500.00
},
{
Timestamp : 1418688900,
TransactionCount : 8,
AverageAmount : 420.00
},
{
Timestamp : 1418689800,
TransactionCount : 14,
Timestamp : [long] Timestamp for every 15 minutes
TransactionCount : [int] Numbers of transaction withinin 15 minutes
AverageAmount : [double] Average amount of transaction within 15 minutes

www.footfallcam.com API Documentation
AverageAmount : 530.00
}]
},
type : "POST",
success : function(r) {
console.log(r);
}
});
Timestamp must be in 15 minutes interval for each record.
PostStaffLabourHour
Description: API Function to receive Staff data.
Data including timestamp, number of staff per 15 minutes
Each data entry must be in 15 minutes interval.
http://footfallcounter.com/api/Action/PostStaffLabourHour
SecretKey : [String] Secret key provided by footfallcam for authentication purpose.
Data: Array of data entries as below:
Example:
{
SecretKey : “0E6A48F765D0FFFFF6247FA80D748E615F91DD0C7431E4D9”,
Data : [{
Timestamp : 1418688000,
StaffCount : 1
},
{
Timestamp : 1418688900,
StaffCount : 1
},
{
Timestamp : 1418689800,
StaffCount : 2
}]
}
Example:
Code: 200
Content: { Response: “OK” }
Example:
Code: 401 UNAUTHORIZED
Content: { error : " UNAUTHORIZED " }
OR
Code: 422 Unprocessable Entry
Timestamp : [long] Timestamp for every 15 minutes
StaffCount : [int] Numbers of Staff withinin 15 minutes

www.footfallcam.com API Documentation
Content: { error : "Invalid Structure" }
$.ajax({
url: "http://controlpanel.retailcam.co.uk/api/Action/PostStaffLabourHour",
dataType: "json",
data : {
SecretKey : “0E6A48F765D0FFFFF6247FA80D748E615F91DD0C7431E4D9”,
Data : [{
Timestamp : 1418688000,
StaffCount : 1
},
{
Timestamp : 1418688900,
StaffCount : 1
},
{
Timestamp : 1418689800,
StaffCount : 2
}]
}
type : "POST",
success : function(r) {
console.log(r);
}
});
Timestamp must be in 15 minutes interval for each record.
3.2 Push Data to FTP Server
A dedicated FTP server will be provided by FootfallCam as a ‘shared folder’ where access (link, username and password) will be given for
retailer to dump the ePOS data, staff labour hours, etc. into it. These data will then being retrieved, further processed to integrate with the
footfall data and generate reports in FootfallCam portal.