[关闭]
@heavysheep 2019-03-08T17:03:48.000000Z 字数 1984 阅读 660

东方网展会项目API文档

未分类


全局约定

地址
api:[get/post] http://localhost:11000/api
ws: ws://localhost:11000/ws

说明
1. 除websocket外,所有接口传输均使用json格式
2. 返回值采用龙井的模式,code=0视为成功

接口

[TEST] 测试连接

参数 类型 是否必填 默认值 说明
method string hello 方法名

示例

  1. {"method":"hello"}

返回

  1. {
  2. "data": "Hello World",
  3. "code": 0,
  4. "message": ""
  5. }

[人脸展示] 获得最后注册/匹配到的x张人脸

请求参数

参数 类型 是否必填 默认值 说明
method string get_last_face 方法名
limit int 5 人脸数量
process int 1 是否进行后处理,1: 是,0: 否

返回参数

参数 类型 说明
user_number string 方法名
age int/string 如process=0, 则返回年龄,否则返回年代
gender string 如process=0, 则返回male/famale,否则返回男/女
last_matched int 最后匹配/注册时间戳
url int 最后匹配/注册的头像相对url

接口示例

  1. {"method":"get_last_face", "limit": 2, "process": 1}

返回示例

  1. {
  2. "code": 0,
  3. "data": {
  4. "content": [
  5. {
  6. "user_number": "000001",
  7. "age": 26,
  8. "gender": "male",
  9. "last_matched": 1551999724,
  10. "url": "/static/face_image/000001.jpg"
  11. },
  12. {
  13. "user_number": "000002",
  14. "age": 27,
  15. "gender": "male",
  16. "last_matched": 1551999410,
  17. "url": "/static/face_image/000002.jpg"
  18. }
  19. ]
  20. },
  21. "message": ""
  22. }

[热力图] 获得区间时间内热力图坐标

说明
[start_time:end_time] 左右均是开区间

请求参数

参数 类型 是否必填 默认值 说明
merchant_number string heatmap_location 商户号
start_time int 起始时间
end_time int 结束时间

返回参数

参数 类型 说明
x float 点在x轴的比例
y float 点在y轴的比例

接口示例

  1. {"method":"heatmap_location", "start_time": 1552028140, "end_time": 1552028427}

返回示例

  1. {
  2. "code": 0,
  3. "data": {
  4. "content": [
  5. {
  6. "x": 0.36,
  7. "y": 0.49
  8. },
  9. {
  10. "x": 0.36,
  11. "y": 0.49
  12. },
  13. {
  14. "x": 0.36,
  15. "y": 0.49
  16. },
  17. {
  18. "x": 0.36,
  19. "y": 0.49
  20. },
  21. {
  22. "x": 0.28,
  23. "y": 0.46
  24. }
  25. ]
  26. },
  27. "message": ""
  28. }

[柱状图] 获得区间时间内,经过时间切分的人流

说明
[start_time:end_time] 左右均是开区间
[first_time: now_time + time_range) 区间时间切分左开右闭
如time_range 不可被 end_time - start_time整除,则得到的最后一个单位截止时间是end_time

请求参数

参数 类型 是否必填 默认值 说明
merchant_number string heatmap_location 商户号
start_time int 起始时间
end_time int 结束时间
time_range int 切分时间

返回参数

参数 类型 说明
user_number string 方法名
timestamp int 起始时间
person_num int 从起始时间开始,切分时间内的人数

接口示例

  1. {"method":"person_num", "start_time": 1552028140, "end_time": 1552028427, "time_range": 60}

返回示例

  1. {
  2. "code": 0,
  3. "data": {
  4. "content": [
  5. {
  6. "timestamp": 1552028140,
  7. "person_num": 2
  8. },
  9. {
  10. "timestamp": 1552028200,
  11. "person_num": 1
  12. },
  13. {
  14. "timestamp": 1552028260,
  15. "person_num": 0
  16. },
  17. {
  18. "timestamp": 1552028320,
  19. "person_num": 0
  20. },
  21. {
  22. "timestamp": 1552028380,
  23. "person_num": 2
  24. }
  25. ]
  26. },
  27. "message": ""
  28. }

[websocket] 获得人脸摄像头数据

请求参数
任意真值

返回参数
base64/jpg 格式图片

备注
是否使用其他推流方式可以再议

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注