Customer Flow Statistics

1.Set The Coordinates of Door Threshold

Description

The the door threshold is used to judge whether a person has came in or not. This API is used to set the coordinates of door threshold.

Request link

https://192.168.0.1/openapi/peopleFlow/setDoorLine, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

Below are private parameters for this API, please refer to Public Parameters for more details.

ParameterTypeDescriptionRequiredExample
resolutionintResolution of the image, 0 for 1080p, 1 for 720PY0
start_xintThe x-coordinate of the starting point of the door threshold, range is [0, 1920] for
1080p, and range is [0, 1280] for 720p
Y500
start_yintThe y-coordinate of the starting point of the door threshold, range is [0, 1080] for
1080p, and range is [0, 720] for 720p
Y 500
end_xintThe x-coordinate of the end point of the door threshold, range is [0, 1920] for 1080p,
and range is [0, 1280] for 720p
Y 500
end_yintThe y-coordinate of the end point of the door threshold, range is [0, 1080] for 1080p,
and range is [0, 720] for 720p
Y 500

Response Parameters

ParameterTypeDescription
codeintReturn code, represent the request result,
possible return codes are 0, 1, 2, 3, 5, 7, 277, 278, see Error Code for further details.

Request Example

POST openapi/peopleFlow/setDoorLineHTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=15930292837&sign=IDKNFLK392038KDS932K&resolution=0&start_x=1200&start_y=900&end_x =1500&end_y=900

Response Example

{
"code":  0
}

2.Get The Coordinates of Door Threshold

Description

Get the coordinates of door threshold.

Request link

https://192.168.0.1/openapi/peopleFlow/getDoorLine, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

No private parameter for this API, please refer to Public Parameters for more details.

Response Parameters

ParameterTypeDescription
codeintReturn code, represent the request result,
possible return codes are 0, 1, 2, 3, 5, 7, 260, 261, 262, 263, 264, 276, 277, 279, see Error Code for further details.
resolutionintResolution of the image, 0 for 1080p, 1 for 720P
start_xintThe x-coordinate of the starting point of the door threshold, range is [0, 1920] for
1080p, and range is [0, 1280] for 720p
start_yintThe y-coordinate of the starting point of the door threshold, range is [0, 1080] for
1080p, and range is [0, 720] for 720p
end_xintThe x-coordinate of the end point of the door threshold, range is [0, 1920] for 1080p,
and range is [0, 1280] for 720p
end_yintThe y-coordinate of the end point of the door threshold, range is [0, 1080] for 1080p,
and range is [0, 720] for 720p

Request Example

POST openapi/peopleFlow/getDoorLine HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=15930292837&sign=IDKNFLK392038KDS932K

Response Example

{
    "code": 0,
    "data": {
    "resolution": 0,
    "start_x": 1200,
    "start_y": 900,
    "end_x": 1500,
    "end_y": 900
    }
}

3. Get Flow Statistics Settings

Description

Get flow statistics settings.

Request Link

https://192.168.0.1/openapi/peopleFlow/getConfig, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

No private parameter for this API, please refer to Public Parameters for more details.

Response Parameters

ParameterTypeDescription
codeintReturn code, represent the request result,
possible return codes are 0, 1, 2, 3, 5, 7, see Error Code for further details.
facerecog_intervalintThe deduplication time of face recognition in seconds.
customer_judgemodeintCustomer flow mode, 0 is snapshot mode and 1 is normal mode.

Request Example

POST openapi/peopleFlow/getConfig HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192&timestamp=15930292837&sign=IDKNFLK392038KDS932K

Response Example

{
  "code": 0,
  "data":{
    "facerecog_interval":60,
    "customer_judgemode":1
  }
}

4. Set Flow Statistics Settings

Description

Set flow statistics settings. The parameter “facerecog_interval” is the deduplication time of face recognition, in which period only the first entry of a face will be reported. The parameter “customer_judgemode” sets the customer flow mode. The events will be reported depending on the movement and size change of faces if in normal mode, while in snapshot mode they will be reported immediately once faces show up.

Request Link

https://192.168.0.1/openapi/peopleFlow/setConfig, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

Below are private parameters for this API, please refer to Public Parameters for more details.

ParameterTypeDescription
facerecog_intervalint The deduplication time of face recognition in seconds, range is [0,86400].
customer_judgemodeintCustomer flow mode, 0 is snapshot mode and 1 is normal mode.

Response Parameters

ParameterTypeDescription
codeintReturn code, represent the request result,
possible return codes are 0, 1, 2, 3, 5, 7, see Error Code for further details.

Request Example

POST openapi/peopleFlow/getDoorLine HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192&timestamp=15930292837&facerecog_interval=10&customer_judgemode=0&sign=IDKNFLK392038KDS932K

Response Example

{
  "code": 0
}

5.Get Inflow Customer Statistics For A Specified Time

Description

Get inflow customer statistics in a specified time. Error will be returned if no record is found.

Request link

https://192.168.0.1/openapi/peopleFlow/getPeopleStat, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

Below are private parameters for this API, please refer to Public Parameters for more details.

ParameterTypeDescriptionRequiredExample
start_timelongStart time, UNIX format timestamp in second. Y1578969264
end_timelongEnd time, UNIX format timestamp in second. Y1579055640
periodintTime granularity, 1: half an hour; 2: one hour; 3: one day.Y2

Response Parameters

ParameterTypeDescription
codeint Return code, represent the request result,
possible return codes are 0, 1, 2, 3, 5, 7, 211, 220, 265, 266, 267, 277, 280, see Error Code for further details.
totalintTotal number of people
start_timelongStart time of Statistics
end_timelongEnd time of Statistics
male_num_statarrayThere are 8 integers in the integer array, representing the male statistical
data of 1-6 years old, 7-12 years old, 13-18 years old, 19-28 years old, 29-35
years old, 36-45 years old, 46-55 years old and 56-100 years old respectively.
female_num_statarrayThere are 8 integers in the integer array, representing the female statistical
data of 1-6 years old, 7-12 years old, 13-18 years old, 19-28 years old, 29-35
years old, 36-45 years old, 46-55 years old and 56-100 years old respectively.

Request Example

POST openapi/peopleFlow/getPeopleStat HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=15930292837&sign=IDKNFLK392038KDS932K&start_time=1561910400&end_time=1562083200&period=3

Note: This example is to get the customer flow statistics from 2019-07-01 to 2019-07-02 with the time granularity of one day.

Response Example

{
    "code": 0,
    "data": {
    "total": 2998,
    "stat_list": [{
            "start_time": 1561910400,
            "end_time": 1561996800,
            "total": 1499,
            "male_num_stat": [10, 20, 50, 109, 280, 380, 156, 10],
            "female_num_stat": [11, 34, 50, 78, 132, 45, 123, 11]
        },
        {
            "start_time": 1561996800,
            "end_time": 1562083200,
            "total": 1499,
            "male_num_stat": [10, 20, 50, 109, 280, 380, 156, 10],
            "female_num_stat": [11, 34, 50, 78, 132, 45, 123, 11]
        }]
    }
}

6.Get Pass-by Customer Statistics For A Specified Time

Description

Get pass-by customer statistics in a specified time. Error will be returned if no record is found.

Request link

https://192.168.0.1/openapi/peopleFlow/getPeopleStatPass, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

Below are private parameters for this API, please refer to Public Parameters for more details.

ParameterTypeDescriptionRequiredExample
start_timelongStart time, UNIX format timestamp in second. Y1578969264
end_timelongEnd time, UNIX format timestamp in second. Y1579055640
periodintTime granularity, 1: half an hour; 2: one hour; 3: one day.Y2

Response Parameters

ParameterTypeDescription
codeint Return code, represent the request result,
possible return codes are 0, 1, 2, 3, 5, 7, 211, 220, 265, 266, 267, 277, 280, see Error Code for further details.
totalintTotal number of people
start_timelongStart time of Statistics
end_timelongEnd time of Statistics

Request Example

POST openapi/peopleFlow/getPeopleStatPass HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=15930292837&sign=IDKNFLK392038KDS932K&start_time=1561910400&end_time=1562083200&period=3

Note: This example is to get the customer flow statistics from 2019-07-01 to 2019-07-02 with the time granularity of one day.

Response Example

{
    "code": 0,
    "data": {
    "total": 2998,
    "stat_list": [{
            "start_time": 1561910400,
            "end_time": 1561996800,
            "total": 1499,
        },
        {
            "start_time": 1561996800,
            "end_time": 1562083200,
            "total": 1499,
        }]
    }
}

7.Get Outflow Customer Statistics For A Specified Time

Description

Get outflow customer statistics in a specified time. Error will be returned if no record is found.

Request link

https://192.168.0.1/openapi/peopleFlow/getPeopleStatOut, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

Below are private parameters for this API, please refer to Public Parameters for more details.

ParameterTypeDescriptionRequiredExample
start_timelongStart time, UNIX format timestamp in second. Y1578969264
end_timelongEnd time, UNIX format timestamp in second. Y1579055640
periodintTime granularity, 1: half an hour; 2: one hour; 3: one day.Y2

Response Parameters

ParameterTypeDescription
codeint Return code, represent the request result,
possible return codes are 0, 1, 2, 3, 5, 7, 211, 220, 265, 266, 267, 277, 280, see Error Code for further details.
totalintTotal number of people
start_timelongStart time of Statistics
end_timelongEnd time of Statistics

Request Example

POST openapi/peopleFlow/getPeopleStatOut HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=15930292837&sign=IDKNFLK392038KDS932K&start_time=1561910400&end_time=1562083200&period=3

Note: This example is to get the customer flow statistics from 2019-07-01 to 2019-07-02 with the time granularity of one day.

Response Example

{
    "code": 0,
    "data": {
    "total": 2998,
    "stat_list": [{
            "start_time": 1561910400,
            "end_time": 1561996800,
            "total": 1499,
        },
        {
            "start_time": 1561996800,
            "end_time": 1562083200,
            "total": 1499,
        }]
    }
}

8. Get The List of Visitors In A Specified Time

Description

Get the list of vistors sorted by arrival times in a specified time.

Request link

https://192.168.0.1/openapi/peopleFlow/getVisitorList, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

Below are private parameters for this API, please refer to Public Parameters for more details.

ParameterTypeDescriptionRequiredExample
start_timelongUNIX format timestamp in second.Y1578969264
end_timelongUNIX format timestamp in second.Y1579055640
orderintNumber of records sorted by arrival times.Y50
group_namestringSpecify a face group, default to all face groups.Nvip
genderintGender, 1 for male, 2 for female, both male and female if this parameter not provided.N1
age_rangeintAge group: 1 for [1,6], 2 for [7,12], 3 for [13,18], 4 for [19,28], 5 for [29,35],
6 for [36,45], 7 for [46,55], 8 for [56, 100]
N4
ageintAge and age range are mutually exclusive. First query the faces that meet the age. If the
age is not provided but the age range is provided, query the faces that meet the age range;
if the age and the age range are not provided, query the faces of all ages.
N4
item1stringIt can be matched according to the custom attribute, and the match of the custom attribute 1.
If you need to use the custom attribute query, make sure that the specified face group has added
the corresponding custom attribute, otherwise the query fails (you cannot add the custom attribute
for the group of strangers and regular)
Nvalue1
item2stringMatch of custom attribute 2Nvalue2
item3stringMatch of custom attribute 3Nvalue3
item4stringMatch of custom attribute 4Nvalue4
item5stringMatch of custom attribute 5Nvalue5
page_numintCurrent page number, default and minimum is 1N1
page_sizeintCurrent page entries, default is 10, range is [1, 100]N10

Response Parameters

ParameterTypeDescription
codeint Return code, represent the request result,
possible return codes are 0, 1, 2, 3, 5, 7, 211, 220, 266, 267, 268, 269, 270, 271, 272,
273, 274, 277, 280, 281, 282, see Error Code for further details.
total_numintTotal number of faces meeting the specified conditions
return_numintCurrent number of faces
faceidstringFace ID
group_namestringGroup name
agestringAge. If it is blank, the real age is not set
age_rangeint1 for [1,6], 2 for [7,12], 3 for [13,18], 4 for [19,28], 5 for [29,35], 6 for [36,45], 7 for [46,55], 8 for [56, 100]
genderintGender, 0 for unknown, 1 for male, 2 for female
arrive_timesintNumber of arrivals
item1stringCustom attribute 1, which will be returned only after the user has added it
item2stringCustom attribute 2, which will be returned only after the user has added it
item3stringCustom attribute 3, which will be returned only after the user has added it
item4stringCustom attribute 4, which will be returned only after the user has added it
item5stringCustom attribute 5, which will be returned only after the user has added it

Request Example

The following is a list of face ID information obtained from 30-year-old male VIP guests who have visited most times in two days from June 14, 2019 to June 15, 2019.

POST openapi/peopleFlow/getVisitorList HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=15930292837&sign=IDKNFLK392038KDS932K&
order=2&start_date=1560441600&end_date=1560528000&gropu_name=vip&age=30&gender=1&item1=value1&&item2=value2&&item3=value3&&item4=value5&&item5=value5

Response Example

{
    "code": 0,
    "data": {
    "total_num": 2,
    "return_num": 2,
    "face_list": [{
        "faceid": "000001",
        "group_name": "vip",
        "age": "32",
        "age_range": 5,
        "gender': 1, 
        "arrive_times": 100,
        "item1": value1, //Custom attribute 
        "item2": value2, //Custom attribute 
        "item3": value3, //Custom attribute 
        "item4": value4, //Custom attribute
        "item5": value5 //Custom attribute 
        }, {
        "faceid": "000002",
        "group_name": "vip",
        "age": "30",
        "age_range": 5,
        "gender": 1,
        "arrive_times": 99,
        "item1": value1, //Custom attribute 
        "item2": value2, //Custom attribute
        "item3": value3, //Custom attribute
        "item4": value4, //Custom attribute 
        "item5": value5 //Custom attribute
        }]
    }
}

9. Get The Visit Records of A Specified Face ID

Description

Get the visit records of a specified face ID within a specified time.

Request link

https://192.168.0.1/openapi/peopleFlow/getFaceVisitDetail, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

Below are private parameters for this API, please refer to Public Parameters for more details.

ParameterTypeDescriptionRequiredExample
start_timelongUNIX format timestamp in second.Y1578969264
end_timelongUNIX format timestamp in second.Y1579055640
faceidstringFace IDY 000001

Response Parameters

ParameterTypeDescription
codeint Return code, represent the request result,
possible return codes are 0, 1, 2, 3, 5, 7, 211, 220, 266, 267, 275, 277, 280, see Error Code for further details.
total_timesintTotal visits
came_in_timelong arrayList of visit times

Request Example

POST openapi/peopleFlow/getFaceVisitDetail HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=15930292837&sign=IDKNFLK392038KDS932K&start_time=1561910400&end_time=1562083200&faceid=000002

Note: This example is to get the visit list of faceid “000002” from July 1, 2019 to July 2, 2019.

Response Example

{
    "code": 0,
    "data": {
    "total_times": 2,
    "came_in_time": [1561910400, 1561996800]
    }
}