koala api v3.1 - megvii.nvk.co.th api v3.1(english... · 7/25/2019 koala api v3.1.0 koala api...
TRANSCRIPT
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Koala API V3.1.0 Release date: Jul. 24, 2019
Online- Permissions Interface ................................................................................................................. 7
Logout [api] ............................................................................................................................................. 7
Basic information ............................................................................................................................................ 7
Request parameters ....................................................................................................................................... 7
Return data ..................................................................................................................................................... 7
Login ...................................................................................................................................................... 7
Basic information ............................................................................................................................................ 7
Request parameters ....................................................................................................................................... 8
Return data ..................................................................................................................................................... 8
Online- System Management ................................................................................................................. 9
Delete a single access control device ..................................................................................................... 9
Basic information ............................................................................................................................................ 9
Request parameters ....................................................................................................................................... 9
Return data ..................................................................................................................................................... 9
Create access control device .................................................................................................................. 9
Basic information ............................................................................................................................................ 9
Request parameters ..................................................................................................................................... 10
Return data ................................................................................................................................................... 10
Update a single access control device ...................................................................................................11
Basic information .......................................................................................................................................... 11
Request parameters ..................................................................................................................................... 11
Return data ................................................................................................................................................... 11
Get a single access control device.........................................................................................................12
Basic information .......................................................................................................................................... 12
Request parameters ..................................................................................................................................... 12
Return data ................................................................................................................................................... 12
Get all hosts ..........................................................................................................................................13
Basic information .......................................................................................................................................... 13
Request parameters ..................................................................................................................................... 13
Return data ................................................................................................................................................... 13
Get access control device list ................................................................................................................14
Basic information .......................................................................................................................................... 14
Request parameters ..................................................................................................................................... 14
Return data ................................................................................................................................................... 14
Online - Recognition Records ................................................................................................................15
Delete a single recognition record..........................................................................................................15
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Basic information .......................................................................................................................................... 15
Request parameters ..................................................................................................................................... 15
Return data ................................................................................................................................................... 16
History traversal interface ......................................................................................................................16
Basic information .......................................................................................................................................... 16
Interface use ................................................................................................................................................. 16
Request parameters ..................................................................................................................................... 16
Return data ................................................................................................................................................... 17
Recognition record list ...........................................................................................................................17
Basic information .......................................................................................................................................... 17
Request parameters ..................................................................................................................................... 19
Return data ................................................................................................................................................... 19
Batch delete recognition records ...........................................................................................................20
Basic information .......................................................................................................................................... 20
Request parameters ..................................................................................................................................... 20
Return data ................................................................................................................................................... 21
Online- Employee Management.............................................................................................................21
Upload personnel library ........................................................................................................................21
Basic information .......................................................................................................................................... 21
Request parameters ..................................................................................................................................... 21
Return data ................................................................................................................................................... 21
Personnel List ........................................................................................................................................22
Basic information .......................................................................................................................................... 22
Request parameters ..................................................................................................................................... 22
Return data ................................................................................................................................................... 22
Personnel head portrait .........................................................................................................................23
Basic information .......................................................................................................................................... 23
Request parameters ..................................................................................................................................... 24
Return data ................................................................................................................................................... 24
Quality inspection on images to enter the library ....................................................................................24
Basic information .......................................................................................................................................... 24
Quality inspection on images to enter the library ......................................................................................... 24
Request parameters ..................................................................................................................................... 24
Return data ................................................................................................................................................... 25
Create user ............................................................................................................................................25
Basic information .......................................................................................................................................... 25
Request parameters ..................................................................................................................................... 25
Return data ................................................................................................................................................... 26
Create user and upload to library ...........................................................................................................27
Basic information .......................................................................................................................................... 27
Request parameters ..................................................................................................................................... 27
Return data ................................................................................................................................................... 27
Delete subject library .............................................................................................................................28
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Basic information .......................................................................................................................................... 28
Request parameters ..................................................................................................................................... 28
Return data ................................................................................................................................................... 29
Delete data of a single subject ...............................................................................................................29
Basic information .......................................................................................................................................... 29
Request parameters ..................................................................................................................................... 29
Return data ................................................................................................................................................... 30
Update data of a single subject ..............................................................................................................30
Basic information .......................................................................................................................................... 30
Request parameters ..................................................................................................................................... 30
Return data ................................................................................................................................................... 31
Get data of a single subject ...................................................................................................................32
Basic information .......................................................................................................................................... 32
Request parameters ..................................................................................................................................... 32
Return data ................................................................................................................................................... 32
Online- Attendance Management ..........................................................................................................33
Attendance record .................................................................................................................................33
Basic information .......................................................................................................................................... 33
Request parameters ..................................................................................................................................... 34
Return data ................................................................................................................................................... 34
Online- Comprehensive Management....................................................................................................35
Interface for comprehensive statistics on homepage .............................................................................35
Basic information .......................................................................................................................................... 35
Request parameters ..................................................................................................................................... 35
Return data ................................................................................................................................................... 35
Online- Access Control Group ...............................................................................................................35
Get access control group list..................................................................................................................35
Basic information .......................................................................................................................................... 35
Request parameters ..................................................................................................................................... 36
Return data ................................................................................................................................................... 36
Get access control group and contained access controls ......................................................................36
Basic information .......................................................................................................................................... 36
Request parameters ..................................................................................................................................... 37
Return data ................................................................................................................................................... 37
Create access control group ..................................................................................................................37
Basic information .......................................................................................................................................... 37
Request parameters ..................................................................................................................................... 38
Return data ................................................................................................................................................... 38
Update access control group .................................................................................................................38
Basic information .......................................................................................................................................... 38
Request parameters ..................................................................................................................................... 38
Return data ................................................................................................................................................... 39
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Delete access control group ..................................................................................................................39
Basic information .......................................................................................................................................... 39
Request parameters ..................................................................................................................................... 39
Return data ................................................................................................................................................... 39
Add access control to access control group ...........................................................................................39
Basic information .......................................................................................................................................... 39
Request parameters ..................................................................................................................................... 40
Return data ................................................................................................................................................... 40
Delete access control from access control group ...................................................................................40
Basic information .......................................................................................................................................... 40
Request parameters ..................................................................................................................................... 40
Return data ................................................................................................................................................... 41
Online- Personnel Group .......................................................................................................................41
Get personnel group list .........................................................................................................................41
Basic information .......................................................................................................................................... 41
Request parameters ..................................................................................................................................... 41
Return data ................................................................................................................................................... 41
Get personnel group and contained personnel ......................................................................................42
Basic information .......................................................................................................................................... 42
Request parameters ..................................................................................................................................... 42
Return data ................................................................................................................................................... 42
Create personnel group .........................................................................................................................43
Basic information .......................................................................................................................................... 43
Request parameters ..................................................................................................................................... 43
Return data ................................................................................................................................................... 44
Update personnel group ........................................................................................................................44
Basic information .......................................................................................................................................... 44
Request parameters ..................................................................................................................................... 44
Return data ................................................................................................................................................... 44
Add personnel to personnel group .........................................................................................................45
Basic information .......................................................................................................................................... 45
Request parameters ..................................................................................................................................... 45
Return data ................................................................................................................................................... 45
Delete personnel from personnel group .................................................................................................45
Basic information .......................................................................................................................................... 45
Request parameters ..................................................................................................................................... 46
Return data ................................................................................................................................................... 46
Online- Access Control Permissions ......................................................................................................46
Create access control settings ...............................................................................................................46
Basic information .......................................................................................................................................... 46
Request parameters ..................................................................................................................................... 46
Return data ................................................................................................................................................... 47
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Delete access control settings ...............................................................................................................47
Basic information .......................................................................................................................................... 47
Request parameters ..................................................................................................................................... 47
Return data ................................................................................................................................................... 48
Update access control settings ..............................................................................................................48
Basic information .......................................................................................................................................... 48
Request parameters ..................................................................................................................................... 48
Return data ................................................................................................................................................... 48
Get access control setting list ................................................................................................................49
Basic information .......................................................................................................................................... 49
Request parameters ..................................................................................................................................... 49
Return data ................................................................................................................................................... 49
Online- Access Control Period & Holiday Management .........................................................................50
Get period list ........................................................................................................................................50
Basic information .......................................................................................................................................... 50
Request parameters ..................................................................................................................................... 50
Return data ................................................................................................................................................... 51
Create period rule ..................................................................................................................................53
Basic information .......................................................................................................................................... 53
Request parameters ..................................................................................................................................... 54
Return data ................................................................................................................................................... 55
Update period rule .................................................................................................................................55
Basic information .......................................................................................................................................... 55
Request parameters ..................................................................................................................................... 55
Return data ................................................................................................................................................... 56
Delete period rule ..................................................................................................................................57
Basic information .......................................................................................................................................... 57
Request parameters ..................................................................................................................................... 57
Return data ................................................................................................................................................... 57
Get holiday list .......................................................................................................................................58
Basic information .......................................................................................................................................... 58
Request parameters ..................................................................................................................................... 58
Return data ................................................................................................................................................... 58
Create holiday rule ................................................................................................................................59
Basic information .......................................................................................................................................... 59
Request parameters ..................................................................................................................................... 60
Return data ................................................................................................................................................... 60
Update holiday rule ................................................................................................................................60
Basic information .......................................................................................................................................... 60
Request parameters ..................................................................................................................................... 60
Return data ................................................................................................................................................... 61
Delete holiday rule .................................................................................................................................61
Basic information .......................................................................................................................................... 61
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Request parameters ..................................................................................................................................... 61
Return data ................................................................................................................................................... 61
Host- System Management ...................................................................................................................62
Host NTP client control ..........................................................................................................................62
Basic information .......................................................................................................................................... 62
Request parameters ..................................................................................................................................... 62
Return data ................................................................................................................................................... 62
Host NTP client configuration ................................................................................................................62
Basic information .......................................................................................................................................... 62
Request parameters ..................................................................................................................................... 62
Return data ................................................................................................................................................... 63
Callback face capture image status .......................................................................................................63
Basic information .......................................................................................................................................... 63
Request parameters ..................................................................................................................................... 63
Return data ................................................................................................................................................... 63
Set callback address .............................................................................................................................63
Basic information .......................................................................................................................................... 63
Request parameters ..................................................................................................................................... 64
Return data ................................................................................................................................................... 64
Host-Recognition ...................................................................................................................................64
1: 1 authentication .................................................................................................................................64
Basic information .......................................................................................................................................... 64
Request parameters ..................................................................................................................................... 64
Return data ................................................................................................................................................... 65
Dynamic 1:1 interface ............................................................................................................................65
Basic information .......................................................................................................................................... 65
Request parameters ..................................................................................................................................... 66
Return data ................................................................................................................................................... 66
Get recognition result.............................................................................................................................66
Basic information .......................................................................................................................................... 66
Request parameters ..................................................................................................................................... 68
Return data ................................................................................................................................................... 68
Static 1:n recognition .............................................................................................................................68
Basic information .......................................................................................................................................... 68
Request parameters ..................................................................................................................................... 68
Return data ................................................................................................................................................... 69
Error Code Definitions ...........................................................................................................................69
Error code information .................................................................................................................................. 69
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Online- Permissions Interface
Logout [api]
Basic information
Path: /api/v2/auth
Method: DELETE
Tag: open
Interface description:
Logout interface, belonging to api v2.
Compared with the previous version /auth/logout, the http method is switched to delete, and finally there is no redirect operation.
Request parameters
Headers
Parameter
name Parameter value Required Example Remarks
Content-Type application/x-www-form-urlencoded Yes
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
page object No
Login
Basic information
Path: /auth/login
Method: POST
Tag: open,Koala3.1.0
Interface description:
Sign in and get a cookie, and this cookie must be brought in when requesting all subsequent interfaces.
To better support the separation of front and back ends, the auth_token parameter is added, and the system supports passing auth_token
into header for login operation.
If used as an interface, set user-agent to "Koala Admin" for this interface, otherwise the login will not be successful.
Please log in with the company's business account, not the [email protected] account.
Request header instance with token: Added parameter for header: Authorization
Accept: application/json
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7
Authorization: e3f14076-571e-4243-b315-bbc4d34547d4
Cache-Control: no-cache
Connection: keep-alive
Cookie: session=b16dfe26-28ed-468b-8ed3-bbb2b4c3eb95
Host: dev.com:8867
Pragma: no-cache
Referer: http://dev.com:8867/api/v2/swagger/doc?_debug_mode=True
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/73.0.3683.103 Safari/537.36
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Body
Name Type Required Remarks Example Other information
username string Yes User name, length: 64
captchas string No Verification code
auth_token string No Whether to return token
password string Yes Password
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ lang string No
├─ username string No
├─ password_reseted boolean No
├─ permission array No
array[string]
├─ verify boolean No
├─ company object No
├─ lang string No
├─ remark string No
├─ door_weekdays array No
array[number]
├─ door_range array No
array[array]
├─ name string No
├─ notdetermined_on boolean No
├─ logo string No
├─ scenario string No
├─ attendance_on boolean No
├─ upload boolean No
├─ id number No
├─ feature_version number No
├─ data_version number No
├─ create_time number No
├─ deployment number No
├─ lang_code string No
├─ attendance_weekdays array No
array[number]
├─ consigner string No
├─ full_day boolean No
├─ fmp_on boolean No
├─ yellowlist_warn boolean No
├─ company_id number No
├─ role_id number No
├─ organization_id null No
├─ avatar string No
├─ lang_code string No
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
├─ id number No
page object No
Online- System Management
Delete a single access control device
Basic information
Path: /system/screen/{sid}
Method: DELETE
Tag: open,Koala3.1.0
Interface description:
Delete a single access control device
Request parameters
Headers
Parameter
name Parameter value Required Example Remarks
Content-Type application/x-www-form-urlencoded Yes
Path parameter
Name Type Required Remarks Example Other information
sid
No Screen id, type: Integer
Return data
Body
{
"code": 0,
"data": {
"box_address": null,
"box_heartbeat": null,
"box_id": null,
"box_status": "1",
"box_token": null,
"camera_address": "8.7.6.5",
"camera_name": null,
"camera_position": "backdoor",
"camera_status": "1",
"description": null,
"group_id": null,
"group_name": "",
"id": 16,
"is_select": 0,
"network_switcher": null,
"network_switcher_drive": 1,
"network_switcher_status": null,
"network_switcher_token": null,
"screen_token": "6daba724-e024-4efd-a091-0e368f005366",
"type": 1
},
"page": {}
}
Create access control device
Basic information
Path: /system/screen
Method: POST
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Tag: open,Koala3.1.0
Interface description:
Create a video stream access control device
When box_token and box_id are passed in at the same time, box_id will be used first.
Box_token is used when box_token and box_id==""
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Body
Name Type Required Remarks Example Other information
network_switcher_drive number No Switch type
box_id number No Id of bound host
box_token string No Token of bound host, length: 128
description string No Description, length: 128
network_switcher string No Switch address, length: 128
camera_name string No Name, length: 64
network_switcher_token string No Switch token, length: 128
camera_address string Yes Video stream address, length: 4096
group_id number No Id of access control group
camera_position string Yes Location, length: 128
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ network_switcher_status null No Switch status
├─ box_id string No Host id
├─ box_token string No Host token
├─ description null No Description
├─ box_heartbeat number No Host heartbeat
├─ network_switcher string No Switch address
├─ screen_token string No Access control device token
├─ camera_name string No Name
├─ camera_status null No Status
├─ camera_position string No Location
├─ box_status string No Host status
├─ network_switcher_token null No Switch token
├─ box_address string No Host address
├─ is_select number No Whether to bind host
├─ network_switcher_drive number No Switch type
├─ type number No Access control device type
├─ id number No
├─ camera_address string No Video stream address
page object No
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Update a single access control device
Basic information
Path: /system/screen/{sid}
Method: PUT
Tag: open,Koala3.1.0
Interface description:
Update an access control device. Use the parameter length indicated in "Create access control device". All parameters are optional, but at least one
parameter is required for operation.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
sid
No Screen id, type: Integer
Body
Name Type Required Remarks Example Other information
network_switcher_drive number No Switch type
box_id number No Id of bound host
description string No Description
network_switcher string No Switch address
camera_name string No Name
network_switcher_token string No Switch token
camera_address string No Video stream address
is_select number No Whether to bind host
group_id number No Group id
camera_position string No Location
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ network_switcher_status null No Switch status
├─ box_id string No Host id
├─ box_token string No Host token
├─ description null No Description
├─ box_heartbeat number No Host heartbeat
├─ network_switcher string No Switch address
├─ screen_token string No Access control device token
├─ camera_name string No Name
├─ camera_status null No Status
├─ camera_position string No Location
├─ box_status string No Host status
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
├─ network_switcher_token null No Switch token
├─ box_address string No Host address
├─ is_select number No Whether to bind host
├─ network_switcher_drive number No Switch type
├─ type number No Access control device type
├─ id number No
├─ camera_address string No Video stream address
page object No
Get a single access control device
Basic information
Path: /system/screen/{sid}
Method: GET
Tag: open,Koala3.1.0
Interface description:
Use screen.id to get information about a specific device.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Path parameter
Name Type Required Remarks Example Other information
sid
No Screen id, type: Integer
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ network_switcher_drive number No Switch type
├─ network_switcher_status null No Switch status
├─ box_id number No Host id
├─ box_token string No Host token
├─ description null No Description
├─ box_heartbeat number No Host heartbeat time
├─ network_switcher string No Switch address
├─ screen_token string No Device token
├─ camera_name string No Name
├─ camera_status string No Camera status
├─ camera_position string No Location
├─ box_status string No Host status
├─ group_name string No Group name
├─ network_switcher_token null No Switch token
├─ box_address string No Host ip
├─ is_select number No Whether to estimate host
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
├─ group_id number No Group id
├─ type number No Device type
├─ id number No Device id
├─ camera_address string No Video stream address
page object No
Get all hosts
Basic information
Path: /system/boxes
Method: GET
Tag: open,Koala3.1.0
Interface description:
Get all available local hosts.
Meaning of type fields in screen:
1: Camera
2: Access control pad
3: Foreground pad
4: Cloud offline pad
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Return data
Body
Name Type Required Remarks Example Other information
code number No
data array No
array[object]
├─ leaf_config object No Firmware configuration
├─ verify number No
├─ yaw number No
├─ blurriness number No
├─ fmp number No
├─ unthreshold number No
├─ facemin number No
├─ pitch number No
├─ threshold number No
├─ roll number No
├─ model number No Model version
├─ box_token string No Host token
├─ dog_expiration string No Encryption dog expiration time
├─ company_id number No Company ID
├─ facemin number No
├─ status string No
├─ box_address string No Host address
├─ heartbeat number No Heartbeat timestamp
├─ all_screens array No All screens bound to host
array[object]
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
├─ network_switcher_status string No Switch status
├─ box_id number No Id of bound host
├─ box_token string No Token of bound host
├─ description string No Description
├─ box_heartbeat number No Heartbeat of bound host
├─ network_switcher string No Switch address
├─ screen_token string No Device token
├─ camera_name [u'string', u'null'] No Name
├─ camera_status string No Status
├─ camera_position string No Location
├─ box_status string No Status of bound host
├─ network_switcher_token string No Switch token
├─ box_address string No Address of bound host
├─ is_select number No Whether to select access control
device permanently
├─ network_switcher_drive number No Switch type
├─ type number No Type:
├─ id number No
├─ camera_address string No Video address
├─ current_version string No Local version
├─ firmware_version string No Firmware version
├─ id number No
page object No
Get access control device list
Basic information
Path: /system/screen
Method: GET
Tag: open,Koala3.1.0
Interface description:
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Query
Name Type Required Remarks Example Other information
device_name
No Device location or device address d
box_token
No Host token token
device_status
No Device status: 1 Normal, 0 Failure 1
group_id
No Group id, optional values: -1 All, 0 Ungrouped,
corresponding group id
page
No Number of pages, default: 1
size
No Items per page, default: 500
Return data
Body
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
code number No
data array No
array[object]
├─ network_switcher_drive number No Switch type
├─ network_switcher_status null No Switch status
├─ box_id number No Host id
├─ box_token string No Token of bound host
├─ description null No
├─ box_heartbeat number No Heartbeat time of bound host
├─ network_switcher null No Switch address
├─ screen_token string No Device token
├─ camera_name null No Name
├─ camera_status string No Camera status
├─ camera_position string No Location
├─ box_status string No Status of bound host
├─ group_name string No Group name
├─ network_switcher_token null No Switch token
├─ box_address null No Address of bound host
├─ is_select number No Whether to select host
├─ server_time number No System time
├─ group_id number No Group id
├─ type number No Type
├─ id number No Device id
├─ camera_address null No Address
page object No
├─ count number No
├─ current number No
├─ total number No
├─ size number No
Online - Recognition Records
Delete a single recognition record
Basic information
Path: /event/events/{eid}
Method: DELETE
Tag: open,Koala3.1.0
Interface description:
Delete a single recognition record and return the deleted data.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/x-www-form-urlencoded Yes
Path parameter
Name Type Required Remarks Example Other information
eid
No Type: Integer 1
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ confidence number No
├─ fmp_error boolean No
├─ group number No
├─ event_type number No
├─ timestamp number No
├─ gender number No
├─ age number No
├─ company_id number No
├─ fmp number No
├─ subject_id null No
├─ photo string No
├─ quality number No
├─ id number No
├─ uuid null No
page object No
History traversal interface
Basic information
Path: /event/scan
Method: POST
Tag: open,Koala3.1.0
Interface description:
Interface use
First use
Parameters required
event_type: Event type: All types of records by default, 0: Recognition records, 1: Unrecognized records, 2: Open the door with password
subject_tpe: Personnel type: 0: Employee, 1: Visitor (including vip), 2: Vip visitor, 3: Yellow list, 100: Stranger
limit: Quantity of data to get: 100 by default, cannot be greater than 5000
Reuse
After the interface is called for the first time, cursor is returned in the result for the next request.
Parameters required
cursor: Cursor parameter, which will be returned every time a request is made. The Cursor in the data returned by the previous request is
required for the next request.
limit: Quantity limit, it needs to be passed in every time
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/x-www-form-urlencoded Yes
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Body
Name Type Required Remarks Example Other
information
event_type text No
Record type: 0: Recognition records,
1: Unrecognized records, 2: Open the
door with password
0
subject_type text No
Type: 0: Employee, 1: Visitor
(including vip), 2: Vip visitor, 3: Yellow
list, 100: Stranger
0
cursor text No base64 character string a29hbGFfLTFfLTFfODI5Nzc=\n
limit text No Quantity limit, cannot be greater than
5000 100
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ count number No
├─ cursor string No
├─ events array No
array[object]
├─ confidence number No
├─ fmp_error boolean No
├─ group number No
├─ event_type number No
├─ timestamp number No
├─ gender number No
├─ age number No
├─ company_id number No
├─ fmp number No
├─ subject_id null No
├─ photo string No
├─ screen object No
├─ camera_position string No
├─ quality number No
├─ id number No
├─ uuid null No
page object No
Recognition record list
Basic information
Path: /event/events
Method: GET
Tag: open,Koala3.1.0
Interface description:
Get the recognition record list
The employee page gets fixed employee recognition records such as: /event/events?subject_id=100248&size=5&_=1558319105303
event_type
○ 0: Recognition
○ 1: Unrecognized
○ 2: Open the door with password
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
start: Start timestamp
end: End timestamp
User_role subject and event_type combined filtering parameters
○ 0: Employee
○ 1: Ordinary visitor
○ 2: VIP visitor
○ 3: Yellow list
○ 4: Unrecognized type data, i.e., event_type=1
category: Categories
○ user: event_type, including 1,0
○ warning: Stranger
○ visitor: subject_type: 1: Ordinary visitor
○ fmp: fmp_error = 1
○ yellowlist: subject_type: 3: Yellow list
○ Others: subject_type: -1
screen_id: Camera id, that is, the search can only be made on cameras that haven't been deleted at this time.
user_name: User name
subject_id: User id
page: Page number
size: Data volume in the page, cannot be greater than 1000
In the returned results:
When the screen data is deleted, only the camera_position field is available, which is used for front-end display. When it is not deleted, more
screen fields will be available but not be used for front-end display.
{
"allow_all_subjects": true,
"allow_visitor": true,
"box_address": "10.169.0.62",
"box_heartbeat": 1557728671,
"box_status": "0",
"box_token": "b2790046-5250-4d78-a46f-d921a7bb4bec",
"camera_address": "10.169.0.94",
"camera_name": null,
"camera_position": "15",
"camera_status": "0",
"description": null,
"id": 16,
"is_select": 0,
"network_switcher": null,
"network_switcher_drive": 1,
"network_switcher_status": null,
"network_switcher_token": null,
"screen_token": "61a1f5fba371257a",
"type": 2
}
When the subject data is deleted, only the avatar, name, and subject_type fields are available, which are also used for front-end display. More
fields will be available if it is not deleted.
{
"avatar": "/static/upload/photo/2019-05-10/v2_c3fc49a1dca04ced42f7114ec453c9b01cfc85e3.jpg",
"birthday": null,
"come_from": "",
"company_id": 3,
"create_time": 1557475623,
"department": "",
"description": "",
"email": "[email protected]",
"end_time": 0,
"entry_date": null,
"gender": 0,
"id": 2,
"interviewee": "",
"interviewee_pinyin": "",
"job_number": "",
"name": "1",
"password_reseted": false,
"phone": "",
"photos": [{
"company_id": 3,
"id": 2,
"quality": 0.99651,
"subject_id": 2,
"url":
"/static/upload/photo/2019-05-10/v2_c3fc49a1dca04ced42f7114ec453c9b01cfc85e3.jpg",
"version": 7
}],
"pinyin": "1",
"purpose": 0,
"remark": "",
"start_time": 0,
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
"subject_type": 0,
"title": "",
"visit_notify": false
}
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Query
Name Type Required Remarks Example Other
information
category
No Type: String, available values: user: All; visitor: Visitor; Fmp:
Non-living body; yellowlist: Yellow list, warning: Stranger user
start
No Start timestamp, type: int, default: 0 0
end
No End timestamp, type: Int, default: 9999999999 9999999999
user_role
No Filter conditions: User type & Event type, Type: Int 2
user_name
No User name, type: String user
screen_id
No Camera id, type: Int 1
subject_id
No Subject id, type: Int 1024
page
No Page number 2
size
No Data volume in the page 10
Return data
Body
Name Type Required Remarks Example Other information
code number No
data array No
array[object]
├─ confidence number No Confidence
├─ fmp_error boolean No Whether living
├─ group number No
├─ event_type number No Event type
├─ timestamp number No
├─ gender number No Gender
├─ age number No Age
├─ company_id number No Company id
├─ fmp number No fmp score
├─ subject_id null No
├─ photo string No Face capture image path
├─ screen object No
├─ camera_position string No Camera location
├─ uuid [u'string', u'null'] No
├─ quality number No Quality
├─ id number No
├─ subject object No
├─ subject_type number No Type
├─ avatar string No Head portrait
├─ name string No Name
page object No
├─ count number No
├─ current number No
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
├─ total number No
├─ size number No
Batch delete recognition records
Basic information
Path: /event/events
Method: DELETE
Tag: open,Koala3.1.0
Interface description:
The interface for batch deleting recognition records. The parameters used here are basically the same as those for getting the recognition record list.
The data is returned directly after the request. The deletion will be performed by koala_worker at the backend.
Only the company administrator can see the front-end button and perform the sub-task.
event_type
○ 0: Recognition
○ 1: Unrecognized
○ 2: Open the door with password
start: Start timestamp
end: End timestamp
User_role subject and event_type combined filtering parameters
○ 0: Employee
○ 1: Ordinary visitor
○ 2: VIP visitor
○ 3: Yellow list
○ 4: Unrecognized type data, i.e., event_type=1
category: Categories
○ user: event_type: including 1, 0
○ visitor: subject_type: 1: Ordinary visitor
○ fmp: fmp_error = 1
○ yellowlist: subject_type: 3: Yellow list
○ Others: subject_type: -1
screen_id: Camera id, that is, the search can only be made on cameras that haven't been deleted at this time.
user_name: User name
subject_id: User id, not in use at the moment
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/x-www-form-urlencoded Yes
Query
Name Type Required Remarks Example Other
information
category
No Type: String, available values: user: All; visitor: Visitor;
Fmp: Non-living body; yellowlist: Yellow list user
start
No Start timestamp, type: Int, default: 0 0
end
No End timestamp, type: Int, default: 9999999999 9999999999
user_role
No Filter conditions: User type & Event type, Type: Int 2
user_name
No User name, type: String user
screen_id
No Camera id, type: Int 1
subject_id
No Subject id, type: Int 1024
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
page object No
Online- Employee Management
Upload personnel library
Basic information
Path: /subject/photo
Method: POST
Tag: open,Koala3.1.0
Interface description:
Upload personnel library
When neither subject_id nor old_photo_id is passed in,
○ it indicates that only the image is converted to the library and added to the photo table.
When subject_id is passed in,
○ it indicates that the library is bound with subject.
When both subject_id and old_photo_id are passed in,
○ it indicates that the subject-specific library is replaced.
The photo_id returned can be used when creating and updating users.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type multipart/form-data Yes
Body
Name Type Required Remarks Example Other information
photo file Yes subject library image
subject_id text No Type: Integer, default: 0
old_photo_id text No Type: Integer, default: 0
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ url string No Library saving path
├─ subject_id null No subject id
├─ company_id number No Company id
├─ id number No photo id
├─ version number No Version
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
├─ quality number No Quality
├─ origin_url string No Original image saving address
page object No
Personnel List
Basic information
Path: /subject/list
Method: GET
Tag: open,Koala3.1.0
Interface description:
Due to changes in permissions management, the screen_id and is_bind parameters are not used in versions later than 3.1.0.
Query employee
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Query
Name Type Required Remarks Example Other
information
category
Yes Employee: Employee, visitor: Visitor, yellowlist: Yellow list employee
name
No Personnel name Heguangyu
department
No Employee's department QA
interviewee
No Name of inviter
start_time
No Registration start time, i.e., data creation time
end_time
No Registration end time, i.e., data creation time
screen_id
No Not in use in versions later than 3.1.0. Screen id// not
passed from front end, not in use at the moment
is_bind
No
Not in use in versions later than 3.1.0. Whether to bind
users, used with screen_id to query users bound to
specific cameras.
bool
filterstr
No When passed in, it will match the subject's name or
department, or
Name or
department
remark
No When category=="yellowlist", it is used to search the
yellow list for personnel with remarks. Remarks
Return data
Body
Name Type Required Remarks Example Other information
code number No
data array No Employee list
array[object]
├─ subject_type number No Type
├─ visit_notify boolean No Whether to notify about visit, used for app
├─ create_time number No Time created
├─ id number No id
├─ title string No Position
├─ company_id number No Company id
├─ job_number string No Employee number
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
├─ entry_date null No Entry date
├─ department string No Department
├─ email string No Email address
├─ end_time number No Visitor end time
├─ password_reseted boolean No Whether to reset password
├─ description string No Description
├─ pinyin string No Name in pinyin
├─ start_time number No Visitor start time
├─ interviewee string No Name of employee to visit
├─ phone string No Phone
├─ birthday null No Birth Date
├─ purpose number No Visiting purpose
├─ groups object No Group
├─ id integer No Group id
├─ name string No Group name
├─ come_from string No From, visitor field
├─ remark string No Remarks
├─ name string No Name
├─ photos array No Library list
array[object]
├─ url string No Image address
├─ subject_id number No
├─ company_id number No Company id
├─ id number No id
├─ version number No Version
├─ quality number No Image quality
├─ origin_url string No Original image
├─ gender number No Gender
├─ avatar string No Head portrait
├─ interviewee_pinyin string No
page object No
├─ count number No Total number of page(s)
├─ current number No Current page number
├─ total number No Total number of page(s)
├─ size number No Number of page(s)
Personnel head portrait
Basic information
Path: /subject/avatar
Method: POST
Tag: open,Koala3.1.0
Interface description:
Change subject head portrait
If subject_id is passed in, this subject head portrait is updated. If not, the image will be saved only.
Return data instance: image_uri can be used for creating employees: /subject, **updating the data of a single subject: /subject/int:sid**.
{
"code": 0,
"data": {
"image_uri": "/static/upload/avatar/2019-05-16/v2_50414ce89d5834155a5513e71d41412f67622cd4.j
pg",
"url": "http://10.169.2.153/static/upload/avatar/2019-05-16/v2_50414ce89d5834155a5513e71d414
12f67622cd4.jpg"
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
},
"page": {}
}
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type multipart/form-data Yes
Body
Name Type Required Remarks Example Other information
avatar file Yes Head portrait image
subject_id text No subject id
Return data
Body
Name Type Required Remarks Example Other information
code number Yes
data object Yes
├─ url string No Head portrait path
├─ image_uri string No Image path
page object Yes
Quality inspection on images to enter the library
Basic information
Path: /subject/photo/check
Method: POST
Tag: Koala3.1.0,open
Interface description:
Quality inspection on images to enter the library
Check whether an image is qualified to enter the library
The following is returned after passing the quality inspection
{
"code": 0,
"data": {},
"page": {}
}
Error information is returned upon failure to pass quality inspection, such as
{
"code": -300,
"data": {},
"desc": "没有检测到人脸 (error: 300)"
}
Request parameters
Headers
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Parameter name Parameter value Required Example Remarks
Content-Type multipart/form-data Yes
Body
Name Type Required Remarks Example Other information
photo file Yes Image file
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
page object No
Create user
Basic information
Path: /subject
Method: POST
Tag: open,Koala3.1.0
Interface description:
Interface for creating subjects. Employees, visitors, and yellow lists are all created through this interface.
First call the /subject/photo interface to get the library data, and then pass it in photo_ids.
avatar: For version 3.1.0, this information can be passed in for avatar at the moment: image base64 code (i.e., the old usage mode is also supported)
and head portrait path [see: /subject/avatar]
When subject_type is 0/3, i.e., employee/yellow list, it can be created with name and subject_type alone.
When subject_type is 1/2, that is, visitor/vip, besides name and subject_type, start_time and end_time also need to be passed in.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Body
Name Type Required Remarks Example Other information
subject_type number Yes Type, 0: employee, 1: visitor, 2: vip, 3: yellow list
create_time number No Time created
job_number string No Employee number, length: 64
visitor_type number No Visitor type, 1: visitor, 2: vip visitor
title string No Position, length: 64
entry_date number No Entry date. Timestamp is passed for processing at the backend.
department string No Department, length: 256
email string No Email address, length: 64
photo_ids array No Library id list
array[number]
avatar string No Head portrait, image base64 code, length: 256
description string No Signature, length: 128
start_time number No Visitor start time, timestamp
interviewee string No Visitee, length: 20
phone string No Phone, length: 20
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
birthday number No Birth date. Timestamp is passed for processing at the backend.
purpose number No Visiting purpose
come_from string No From, for visitors, length: 128
remark string No Remarks, length: 128
group_ids array No Group id
array[integer]
name string Yes Name, length: 64
gender number No Gender, 0: unknown, 1: male, 2: female
end_time number No Visitor end time, timestamp
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ subject_type number No Type
├─ visit_notify boolean No Whether to push notification to app
├─ create_time number No Time created
├─ id number No id
├─ title string No Position
├─ company_id number No Company id
├─ job_number string No Employee number
├─ entry_date number No Entry date, timestamp
├─ department string No Department
├─ email string No Email address
├─ end_time number No Visitor end time
├─ password_reseted boolean No
├─ description string No Signature
├─ pinyin string No Name in pinyin
├─ start_time number No Visitor start time
├─ interviewee string No Visitee name
├─ phone string No Phone
├─ birthday number No Birth date, timestamp
├─ purpose number No Visiting purpose
├─ groups object No Group
├─ id integer No Group id
├─ name string No Group name
├─ come_from string No From
├─ remark string No Remarks
├─ name string No Name
├─ photos array No Library list
array[object]
├─ url string No Image address
├─ subject_id number No subject id
├─ company_id number No Company id
├─ version number No Version
├─ quality number No Quality
├─ id number No id
├─ gender number No Gender
├─ avatar string No Head portrait url
├─ interviewee_pinyin string No Visitee name in pinyin
page object No
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Create user and upload to library
Basic information
Path: /subject/file
Method: POST
Tag: Koala3.1.0,open
Interface description:
Interface for creating subjects at the backend only. Head portrait and library parameters are used in the form of files. Employees, visitors and yellow
lists are all created through this interface.
When subject_type is 0/3, i.e., employee/yellow list, it can be created with name and subject_type alone.
When subject_type is 1/2, that is, visitor/vip, besides name and subject_type, start_time and end_time also need to be passed in.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type multipart/form-data Yes
Body
Name Type Required Remarks Example Other information
avatar file No Head portrait
birthday text No Birth date. Timestamp is passed for processing at the backend.
come_from text No From, for visitors, length: 128
department text No Department, length: 256
description text No Signature, length: 128
email text No Email address, length: 64
end_time text No Visitor end time, timestamp
entry_date text No Entry date. Timestamp is passed for processing at the backend.
gender text No Gender, 0: unknown, 1: male, 2: female
group_ids text No Group id
interviewee text No Visitee, length: 20
job_number text No Employee number, length: 64
name text Yes Name, length: 64
phone text No Phone, length: 20
photo file No Library image
purpose text No Visiting purpose
remark text No Remarks, length: 128
start_time text No Visitor start time, timestamp
subject_type text Yes Type, 0: employee, 1: visitor, 2: vip, 3: yellow list
title text No Position, length: 64
visitor_type text No Visitor type, 1: visitor, 2: vip visitor
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ subject_type number No Type
├─ visit_notify boolean No Whether to push notification to app
├─ create_time number No Time created
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
├─ id number No id
├─ title string No Position
├─ company_id number No Company id
├─ job_number string No Employee number
├─ entry_date number No Entry date, timestamp
├─ department string No Department
├─ email string No Email address
├─ end_time number No Visitor end time
├─ password_reseted boolean No
├─ description string No Signature
├─ pinyin string No Name in pinyin
├─ start_time number No Visitor start time
├─ interviewee string No Visitee name
├─ phone string No Phone
├─ birthday number No Birth date, timestamp
├─ purpose number No Visiting purpose
├─ groups object No Group
├─ id integer No Group id
├─ name string No Group name
├─ come_from string No From
├─ remark string No Remarks
├─ name string No Name
├─ photos array No Library list
array[object]
├─ url string No Image address
├─ subject_id number No subject id
├─ company_id number No Company id
├─ version number No Version
├─ quality number No Quality
├─ id number No id
├─ gender number No Gender
├─ avatar string No Head portrait url
├─ interviewee_pinyin string No Visitee name in pinyin
page object No
Delete subject library
Basic information
Path: /subject/photo
Method: DELETE
Tag: open,Koala3.1.0
Interface description:
Delete all libraries for the specified subject
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/x-www-form-urlencoded Yes
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Body
Name Type Required Remarks Example Other information
subject_id text Yes Type: Integer
Return data
Body
{
"code": 0,
"data": {},
"page": {}
}
Delete data of a single subject
Basic information
Path: /subject/{sid}
Method: DELETE
Tag: open,Koala3.1.0
Interface description:
Interface for deleting subjects
For the return data, see: Creation interface: POST /subject
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/x-www-form-urlencoded Yes
Path parameter
Name Type Required Remarks Example Other information
sid
No Subject id, type: Integer
Body
Name Type Required Remarks Example Other information
visitor_type null No Visitor time
remark string No Remarks
subject_type number No Type
start_time number No Visitor start time
description string No Signature
title string No Position
gender number No Gender
purpose number No Visiting purpose
interviewee string No Visitee
name string No Name
phone string No Phone
birthday number No Birth date, timestamp
create_time number No Time created
end_time number No Visitor end time
department string No Department
job_number string No Employee number
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
entry_date number No Entry date, timestamp
photo_ids array No Library list
array[number]
email string No Email address
come_from string No From
avatar string No Head portrait base64
Return data
Body
Name Type Required Remarks Example Other information
Update data of a single subject
Basic information
Path: /subject/{sid}
Method: PUT
Tag: open,Koala3.1.0
Interface description:
Interface for updating subject
For the return data, see: Creation interface: POST /subject
avatar: To support the 3.1.0 front-end split version, this information can be passed in for avatar at the moment: image base64 code (i.e., the old
usage mode is also supported) and head portrait path see: /subject/avatar.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
sid
No Subject id, type: Integer
Body
Name Type Required Remarks Example Other information
subject_type number Yes Type
create_time number No Time created
job_number string No Employee number
visitor_type null No Visitor time
title string No Position
entry_date number No Entry date, timestamp
department string No Department
email string No Email address
photo_ids array Yes Library list. The user’s all libraries will be deleted in case of empty list.
array[number]
avatar string No Head portrait base64
description string No Signature
start_time number No Visitor start time
interviewee string No Visitee
phone string No Phone
birthday number No Birth date, timestamp
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
purpose number No Visiting purpose
come_from string No From
remark string No Remarks
group_ids array No Group id
array[integer]
name string No Name
gender number No Gender
end_time number No Visitor end time
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ subject_type number No
├─ visit_notify boolean No
├─ create_time number No
├─ id number No
├─ title string No
├─ company_id number No
├─ job_number string No
├─ entry_date number No
├─ department string No
├─ email string No
├─ end_time number No
├─ password_reseted boolean No
├─ description string No
├─ pinyin string No
├─ start_time number No
├─ interviewee string No
├─ phone string No
├─ birthday number No
├─ purpose number No
├─ groups object No
├─ id integer No
├─ name string No
├─ come_from string No
├─ remark string No
├─ name string No
├─ photos array No
array[object]
├─ url string No
├─ subject_id number No
├─ company_id number No
├─ version number No
├─ quality number No
├─ id number No
├─ gender number No
├─ avatar string No
├─ interviewee_pinyin string No
page object No
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Get data of a single subject
Basic information
Path: /subject/{sid}
Method: GET
Tag: open,Koala3.1.0
Interface description:
For the return data, see: Creation interface: POST /subject
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Path parameter
Name Type Required Remarks Example Other information
sid
No Subject id, type: Integer
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ subject_type number No
├─ visit_notify boolean No
├─ create_time number No
├─ id number No
├─ title string No
├─ company_id number No
├─ job_number string No
├─ entry_date number No
├─ department string No
├─ email string No
├─ end_time number No
├─ password_reseted boolean No
├─ description string No
├─ pinyin string No
├─ start_time number No
├─ interviewee string No
├─ phone string No
├─ birthday number No
├─ purpose number No
├─ groups object No
├─ id integer No
├─ name string No
├─ come_from string No
├─ remark string No
├─ name string No
├─ photos array No
array[object]
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
├─ url string No
├─ subject_id number No
├─ company_id number No
├─ version number No
├─ quality number No
├─ id number No
├─ gender number No
├─ avatar string No
├─ interviewee_pinyin string No
page object No
Online- Attendance Management
Attendance record
Basic information
Path: /attendance/records
Method: GET
Tag: open,Koala3.1.0
Interface description:
Attendance record interface
clock_in, clock_out value range:
0: Missing clock-in/out
1: Normal
2: Late
3: Leave early
4: Absence
Return data instance:
{
"code": 0,
"data": [
{
"check_in_time": 0,
"check_out_time": 0,
"clock_in": 4,
"clock_out": 4,
"date": 1534867200,
"id": 0,
"subject": {
"avatar": "/static/upload/photo/2019-03-
28/v2_d9d287af957602a0844fc036e275329806cb0e2d.jpg",
"birthday": null,
"create_time": 1553751285,
"department": "QA",
"description": "",
"end_time": null,
"entry_date": null,
"id": 65030,
"interviewee": "",
"interviewee_pinyin": "",
"inviter_id": null,
"job_number": "",
"name": "11133",
"remark": "",
"start_time": null,
"subject_type": 0,
"title": ""
},
"worktime": "0小時 0分"
}
],
"page": {
"count": 8712,
"current": 1,
"size": 1,
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
"total": 8712
}
}
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Query
Name Type Required Remarks Example Other information
start_time
Yes Start time, type: Integer
end_time
Yes End time, type: Integer
user_name
Yes User name
department
Yes Department
subject_id
Yes Employee id, type: Integer
page
Yes Page number, type: Integer 1
size
Yes Data volume in the page, type: Integer 10
Return data
Body
Name Type Required Remarks Example Other information
code number No
data array No
array[object]
├─ clock_in number No Clock in status
├─ worktime string No Working hours
├─ id number No
├─ check_in_time number No Time in:
├─ clock_out number No Clock out status
├─ date number No Date
├─ check_out_time number No Time out
├─ subject object No See subject related information
├─ remark string No
├─ subject_type number No
├─ description string No
├─ name string No
├─ inviter_id null No
├─ start_time null No
├─ title string No
├─ interviewee string No
├─ job_number string No
├─ entry_date null No
├─ birthday null No
├─ create_time number No
├─ end_time null No
├─ department string No
├─ interviewee_pinyin string No
├─ id number No
├─ avatar string No
page object No
├─ count number No
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
├─ current number No
├─ total number No
├─ size number No
Online- Comprehensive Management
Interface for comprehensive statistics on homepage
Basic information
Path: /overview/statistics
Method: GET
Tag: open
Interface description:
Interface for comprehensive statistics on homepage
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ num_yellowlist number No Warning today: Yellow list
├─ video_can_use string No Camera binding: Remaining
├─ subject_count number No Library usage: Number of people
├─ num_visitor number No Visitors today
├─ feature_count number No Library usage: Feature
├─ video_use number No Camera binding: Usage
├─ num_fmp number No Warning today: Non-living
├─ num_stranger number No Warning today: Stranger
├─ all_video_limit string No Camera binding: Total number
├─ num_employee number No Today's employee records
page object No
Online- Access Control Group
Get access control group list
Basic information
Path: /devices/screens/group/list
Method: GET
Tag: open
Interface description:
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Query
Name Type Required Remarks Example Other information
page
No Default: 1 1
size
No Default: 10 10
name
No Maximum: 40 abc
comment
No Maximum: 120 abc
update_user_name
No
order_by
No enum: 'id', 'name', 'update_time',
'update_by', 'screens_count' update_time
order
No enum: 'asc', 'desc' desc
Return data
Body
{
"code": 0,
"data": [
{
"comment": "string",
"id": 16,
"name": "group_a",
"screens": [
{
"box_address": "10.169.5.147",
"box_heartbeat": 1561446293,
"box_id": 1,
"box_status": "0",
"box_token": "acd93630-3cbc-482d-94ef-f7a9cc1371ef",
"camera_address": "rtsp://10.169.1.135/video_low_f.264",
"camera_name": null,
"camera_position": "live555",
"camera_status": "111",
"description": null,
"id": 8,
"is_select": 0,
"network_switcher": null,
"network_switcher_drive": 0,
"network_switcher_status": null,
"network_switcher_token": null,
"screen_token": "4fdd1b32-07f5-4115-af4c-2cf511270cb4",
"type": 1
}
],
"screens_count": 1,
"update_by": "[email protected]",
"update_time": 1561446307
}
],
"page": {
"count": 1,
"current": 1,
"size": 10,
"total": 1
}
}
Get access control group and contained access controls
Basic information
Path: /devices/screens/group/{gid}
Method: GET
Tag: open
Interface description:
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Path parameter
Name Type Required Remarks Example Other information
gid
No Access control group id, type: int
Query
Name Type Required Remarks Example Other information
page
No Paging parameter for contained access controls, default: 1 1
size
No Paging parameter for contained access controls, default: 10 10
Return data
Body
{
"code": 0,
"data": {
"comment": "this is a group",
"id": 1,
"name": "whatever",
"screens": [
{
"allow_all_subjects": false,
"allow_visitor": true,
"box_address": "10.169.1.79",
"box_heartbeat": 1554358182,
"box_status": "1",
"box_token": "0a873411-2ef3-456b-849e-a449943ec5bf",
"camera_address": "rtsp://10.1.2.3:8554/live.sdp",
"camera_name": "no",
"camera_position": "asdasd",
"camera_status": "1",
"description": null,
"id": 1,
"is_select": 1,
"network_switcher": "",
"network_switcher_drive": 0,
"network_switcher_status": null,
"network_switcher_token": null,
"screen_token": "6834542a-fb31-442e-bea7-258090ae2b3a",
"type": 1
}
]
},
"page": {
"count": 1,
"current": 1,
"size": 50,
"total": 1
}
}
Create access control group
Basic information
Path: /devices/screens/group
Method: PUT
Tag: open
Interface description:
POST method is also supported.
Parameter description:
name: String, maximum length 40, required
comment: String, maximum length 120, optional
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Body
Name Type Required Remarks Example Other information
comment string No
name string Yes
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ comment string No
├─ update_by string No
├─ update_time number No
├─ id number No
├─ name string No
page object No
Update access control group
Basic information
Path: /devices/screens/group/{gid}
Method: POST
Tag: open
Interface description:
Parameter:
name: String, maximum length 40, optional
comment: String, maximum length 120, optional
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
gid
No Access control group id, type: int
Body
{
"name": "group_0",
"comment": "update group info"
}
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Return data
Body
{
"code": 0,
"data": {
"comment": "update group info",
"id": 1,
"name": "group_0"
},
"page": {}
}
Delete access control group
Basic information
Path: /devices/screens/group/{gid}
Method: DELETE
Tag: open
Interface description:
Parameter:
extra: Remark information when deleting, length of serialized json should not exceed 1024.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
gid
No Access control group id, type: int
Body
{
"extra": {
"screens_count": 10000,
"screens": "a/b/c"
}
}
Return data
Add access control to access control group
Basic information
Path: /devices/screens/group/{gid}/insert
Method: POST
Tag: open
Interface description:
Parameter:
screen_ids: list<integer>, required
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
gid
No Access control group id, type: int
Body
{
"screen_ids": [
1,
3
]
}
Return data
Body
{
"code": 0,
"data": {},
"page": {}
}
Delete access control from access control group
Basic information
Path: /devices/screens/group/{gid}/delete
Method: POST
Tag: open
Interface description:
Parameter:
screen_ids: list<integer>, required
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
gid
No Access control group id, type: int
Body
Name Type Required Remarks Example Other information
screen_ids array Yes Screen id list
array[number]
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
page object No
Online- Personnel Group
Get personnel group list
Basic information
Path: /subjects/group/list
Method: GET
Tag: open
Interface description:
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Query
Name Type Required Remarks Example Other information
page
No Default: 1 1
size
No Default: 10 10
name
No Maximum: 40 abc
comment
No Maximum: 120
update_user_name
No
megvii
order_by
No enum: 'id', 'name', 'subject_type', 'update_time',
'update_by', 'subject_count' update_time
order
No enum: 'asc', 'desc' desc
subject_type
No 0: Employee, 1: Visitor Not pass or others: All 0
Return data
Body
{
"code": 0,
"data": [
{
"comment": null,
"id": 5,
"name": "another",
"subject_count": 24,
"subject_type": 0,
"update_by": "[email protected]",
"update_time": "2019-06-11 18:24:45"
}
],
"page": {
"count": 1,
"current": 1,
"size": 10,
"total": 1
}
}
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Get personnel group and contained personnel
Basic information
Path: /subjects/group/{gid}
Method: GET
Tag: open
Interface description:
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Path parameter
Name Type Required Remarks Example Other information
gid
No Personnel group id, type: int
Query
Name Type Required Remarks Example Other information
page
No Default: 1 1
size
No Default: 10 10
Return data
Body
{
"code": 0,
"data": {
"comment": "",
"id": 3,
"name": "simple",
"subject_type": 1,
"subjects": [
{
"avatar": "",
"birthday": null,
"come_from": "",
"company_id": 8,
"create_time": 1553751290,
"department": "QA",
"description": "",
"email": "",
"end_time": null,
"entry_date": null,
"gender": 1,
"id": 65045,
"interviewee": "",
"interviewee_pinyin": "",
"job_number": "",
"name": "11127",
"password_reseted": false,
"phone": "",
"pinyin": "11127",
"purpose": 0,
"remark": "",
"start_time": null,
"subject_type": 0,
"title": "",
"visit_notify": false
},
{
"avatar": "",
"birthday": null,
"come_from": "",
"company_id": 8,
"create_time": 1553751291,
"department": "QA",
"description": "",
"email": "",
"end_time": null,
"entry_date": null,
"gender": 1,
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
"id": 65047,
"interviewee": "",
"interviewee_pinyin": "",
"job_number": "",
"name": "1116",
"password_reseted": false,
"phone": "",
"pinyin": "1116",
"purpose": 0,
"remark": "",
"start_time": null,
"subject_type": 0,
"title": "",
"visit_notify": false
},
{
"avatar": "",
"birthday": null,
"come_from": "",
"company_id": 8,
"create_time": 1553751292,
"department": "QA",
"description": "",
"email": "",
"end_time": null,
"entry_date": null,
"gender": 1,
"id": 65050,
"interviewee": "",
"interviewee_pinyin": "",
"job_number": "",
"name": "11132",
"password_reseted": false,
"phone": "",
"pinyin": "11132",
"purpose": 0,
"remark": "",
"start_time": null,
"subject_type": 0,
"title": "",
"visit_notify": false
}
]
},
"page": {
"count": 3,
"current": 1,
"size": 50,
"total": 1
}
}
Create personnel group
Basic information
Path: /subjects/group
Method: PUT
Tag: open
Interface description:
Parameter:
name: String, maximum length 40, required
comment: String, maximum length 120, optional
subject_type: Int, 0: Employee 1: Visitor, optional, default: 0
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Body
Name Type Required Remarks Example Other information
comment string No
subject_type number No
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
name string Yes
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ comment string No
├─ subject_count number No
├─ update_time number No
├─ subject_type number No
├─ name string No
├─ update_by string No
├─ id number No
page object No
Update personnel group
Basic information
Path: /subjects/group/{gid}
Method: POST
Tag: open
Interface description:
name: String, maximum length 40, optional
comment: String, maximum length 120, optional
(subject_type cannot be updated)
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
gid
No Personnel group id, type: int
Body
{
"name": "another_group_name",
"comment": "blablabla"
}
Return data
Body
{
"code": 0,
"data": {
"comment": "blablabla",
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
"id": 6,
"name": "another_group_name"
},
"page": {}
}
Add personnel to personnel group
Basic information
Path: /subjects/group/{gid}/insert
Method: POST
Tag: open
Interface description:
Parameter:
subject_ids: list<integer>, required
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
gid
No Personnel group id, type: int
Body
{
"subject_ids": [
100000,
100001
]
}
Return data
Body
{
"code": 0,
"data": {},
"page": {}
}
Delete personnel from personnel group
Basic information
Path: /subjects/group/{id}/delete
Method: POST
Tag: open
Interface description:
Parameter:
subject_ids: list<integer>, required
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
id
No Personnel group id, type: int
Body
Name Type Required Remarks Example Other information
subject_ids array Yes Personnel id list
array[number]
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
page object No
Online- Access Control Permissions
Create access control settings
Basic information
Path: /access/setting
Method: PUT
Tag: open
Interface description:
Parameter:
name: String, maximum length 40, required
comment: String, maximum length 120, optional
subject_group_id: int, optional, special values, All employees: 0, All visitors: 1
screen_group_ids: list<int>, optional, an empty list can be passed
schedule_ids: list<int>, optional, an empty list can be passed
calendar_ids: list<int>, optional, an empty list can be passed
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Body
{
"name": "rule_no_1",
"comment": "...",
"subject_group_id": 3,
"screen_group_ids": [
1,
4
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
],
"schedule_ids": [
1,
5
],
"calendar_ids": []
}
Return data
Body
{
"code": 0,
"data": {
"id": 3,
"name": "rule_no_2",
"schedule_ids": [
1,
5
],
"calendar_ids": [],
"screen_groups": [
{
"comment": "update group info",
"id": 1,
"name": "group_0"
},
{
"comment": "group info",
"id": 4,
"name": "group_2"
}
],
"subject_group": {
"comment": "",
"id": 3,
"name": "simple"
},
"status": 1,
},
"page": {}
}
Delete access control settings
Basic information
Path: /access/setting/{id}
Method: DELETE
Tag: open
Interface description:
Parameter:
extra: Remark information when deleting, length of serialized json should not exceed 1024.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
id
No Access control setting id, type: int
Body
{
"extra": {
"screen_group": "全门禁",
"calendar": "全时段",
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
"schedule": "-"
}
}
Return data
Body
{
"code": 0,
"data": {},
"page": {}
}
Update access control settings
Basic information
Path: /access/setting/{id}
Method: POST
Tag: open
Interface description:
The status field cannot be updated together with other fields.
Parameter:
status: int, 1: Enable 2: Disabled, optional
name: String, maximum length 40, optional
comment: String, maximum length 120, optional
subject_group_id: int, optional, special values, All employees: 0, All visitors: 1 Not set: null
screen_group_ids: list<int>, optional, an empty list can be passed
schedule_ids: list<int>, optional, an empty list can be passed
calendar_ids: list<int>, optional, an empty list can be passed
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
id
No Access control setting id, type: int
Body
{
"name": "rule_no_2",
"comment": "...",
"subject_group_id": 3,
"screen_group_ids": [
1,
4
],
"schedule_ids": [
1,
5
],
"calendar_ids": [],
"status": 0
}
Return data
Body
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
{
"code": 0,
"data": {
"calendar_ids": [],
"id": 3,
"name": "rule_no_2",
"schedule_ids": [
1,
5
],
"screen_groups": [
{
"comment": "update group info",
"id": 1,
"name": "group_0"
},
{
"comment": "group info",
"id": 4,
"name": "group_2"
}
],
"status": 0,
"subject_group": {
"comment": "",
"id": 3,
"name": "simple"
}
},
"page": {}
}
Get access control setting list
Basic information
Path: /access/setting/list
Method: GET
Tag: open
Interface description:
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Query
Name Type Required Remarks Example Other
information
page
No Default: 1 1
size
No Default: 10 10
subject_id
No Id of filtered person 12345
screen_group_id
No Id of filtered access control group 123
schedule_id
No Id of filtered period rule 456
calendar_id
No Id of filtered holiday rule 789
order_by
No Valid values: 'name', 'subject _ group_id',
'update_time', 'update_by' name
order
No Valid values: 'asc', 'desc' desc
name
No Fuzzy search: Rule name abc
subject_group_name
No Fuzzy search: Personnel group name abc
update_user_name
No Fuzzy search: Operator user name admin
Return data
Body
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
{
"code": 0,
"data": [
{
"calendar_ids": [],
"id": 1,
"name": "nameless",
"schedule_ids": [
1
],
"screen_groups": [
{
"comment": "update group info",
"id": 1,
"name": "group_0"
}
],
"status": 1,
"subject_group": {
"comment": "",
"id": 3,
"name": "simple"
},
"update_by": "[email protected]",
"update_time": "2019-05-29 20:21:36"
},
{
"calendar_ids": [],
"id": 3,
"name": "rule_no_2",
"schedule_ids": [
1,
5
],
"screen_groups": [
{
"comment": "update group info",
"id": 1,
"name": "group_0"
},
{
"comment": "group info",
"id": 4,
"name": "group_2"
}
],
"status": 1,
"subject_group": {
"comment": "",
"id": 3,
"name": "simple"
},
"update_by": "[email protected]",
"update_time": "2019-05-30 16:15:08"
}
],
"page": {
"count": 2,
"current": 1,
"size": 10,
"total": 1
}
}
Online- Access Control Period & Holiday Management
Get period list
Basic information
Path: /access/schedule/list
Method: GET
Tag: open
Interface description:
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Query
Name Type Required Remarks Example Other information
page
No Default: 1 1
size
No Default: 10 50
id
No Filter a single item 1
status
No 0: Deleted, 1: Effective 1
name
No Fuzzy search: Rule name abc
update_user_name
No Fuzzy search: Operator user name admin
order_by
No enum: 'id', 'name', 'update_time', 'update_by' update_time
order
No enum: 'asc', 'desc' desc
Return data
Body
{
"code": 0,
"data": [
{
"comment": "what the",
"end_time": "2019-10-01",
"id": 1,
"name": "test_schedule_2",
"start_time": "2019-05-29",
"time_range": [
[
[
1,
2
],
[
3,
4
]
],
[],
[
[
2000,
3000
],
[
7000,
80000
]
],
[],
[],
[],
[
[
1,
2
],
[
2,
3
],
[
3,
4
]
]
]
},
{
"comment": "no comment",
"end_time": "2019-09-01",
"id": 2,
"name": "first_schedule",
"start_time": "2019-06-01",
"time_range": [
[
[
39216,
46911
],
[
48494,
62614
]
],
[
[
43753,
43824
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
],
[
52533,
75469
],
[
80957,
82878
]
],
[
[
39054,
47995
],
[
51790,
57973
],
[
74060,
83615
]
],
[
[
26476,
30670
],
[
46794,
52777
],
[
53303,
76750
]
],
[
[
76921,
78375
]
],
[],
[]
]
},
{
"comment": "comment here",
"end_time": "2019-07-01",
"id": 5,
"name": "test_schedule_",
"start_time": "2019-01-01",
"time_range": [
[
[
16512,
26370
],
[
33716,
34645
],
[
0,
0
]
],
[
[
34333,
36367
]
],
[
[
20316,
36497
],
[
49312,
68899
],
[
72438,
75984
]
],
[
[
16373,
29782
],
[
33024,
34070
]
],
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
[
[
47184,
48145
],
[
63733,
68268
]
],
[
[
21206,
36286
],
[
57982,
60134
]
],
[
[
32353,
49341
],
[
70852,
77301
],
[
78225,
79578
]
]
]
}
],
"page": {
"count": 3,
"current": 1,
"size": 50,
"total": 1
}
}
Create period rule
Basic information
Path: /access/schedule
Method: PUT
Tag: open
Interface description:
Parameter description:
name: String, maximum length 40, required
comment: String, maximum length 120, optional
start_time: string, a date formatted in "%Y-%m-%d", optional, the current day by default
end_time: string, a date formatted in "%Y-%m-%d", required
time_range, required, <list<pair(int, int)>>; a three-dimensional array with a length of 7.
pair = time_range[i][j] indicates the j-th setting on the i-th day of each week.
pair[0] is the start time and pair[1] is the end time. The value is the number of seconds elapsed from 0.
Request parameter sample:
{
"name": "test_schedule",
"comment": "comment here",
"time_range": [
[
[
16512,
26370
],
[
33716,
34645
],
[
0,
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
0
]
],
[
[
34333,
36367
]
],
[
[
20316,
36497
],
[
49312,
68899
],
[
72438,
75984
]
],
[
[
16373,
29782
],
[
33024,
34070
]
],
[
[
47184,
48145
],
[
63733,
68268
]
],
[
[
21206,
36286
],
[
57982,
60134
]
],
[
[
32353,
49341
],
[
70852,
77301
],
[
78225,
79578
]
]
],
"start_time": "2019-01-01",
"end_time": "2019-07-01"
}
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Body
Name Type Required Remarks Example Other information
comment string No
start_time string No
end_time string No
name string Yes
time_range array Yes
array[array]
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ comment string No
├─ name string No
├─ start_time string No
├─ time_range array No
array[array]
├─ end_time string No
├─ id number No
page object No
Update period rule
Basic information
Path: /access/schedule/{id}
Method: POST
Tag: open
Interface description:
Parameters are the same as those indicated in “Create period rule”.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
id
No Period rule id, type: int 1
Body
{
"name": "first_schedule",
"comment": "no comment",
"time_range": [
[
[
39216,
46911
],
[
48494,
62614
]
],
[
[
43753,
43824
],
[
52533,
75469
],
[
80957,
82878
]
],
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
[
[
39054,
47995
],
[
51790,
57973
],
[
74060,
83615
]
],
[
[
26476,
30670
],
[
46794,
52777
],
[
53303,
76750
]
],
[
[
76921,
78375
]
],
[],
[]
],
"start_time": "2019-06-01",
"end_time": "2019-09-01"
}
Return data
Body
{
"code": 0,
"data": {
"id": 2,
"comment": "no comment",
"end_time": "2019-09-01",
"name": "first_schedule",
"start_time": "2019-06-01",
"time_range": [
[
[
39216,
46911
],
[
48494,
62614
]
],
[
[
43753,
43824
],
[
52533,
75469
],
[
80957,
82878
]
],
[
[
39054,
47995
],
[
51790,
57973
],
[
74060,
83615
]
],
[
[
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
26476,
30670
],
[
46794,
52777
],
[
53303,
76750
]
],
[
[
76921,
78375
]
],
[],
[]
]
},
"page": {}
}
Delete period rule
Basic information
Path: /access/schedule/{id}
Method: DELETE
Tag: open
Interface description:
Parameter:
extra: Remark information when deleting, length of serialized json should not exceed 1024.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
id
No Period rule id, type: int
Body
{
"extra": {
"start_time": "2000-01-01",
"end_time": "2020-01-01"
}
}
Return data
Body
{
"code": 0,
"data": {},
"page": {}
}
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Get holiday list
Basic information
Path: /access/calendar/list
Method: GET
Tag: open
Interface description:
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Query
Name Type Required Remarks Example Other information
id
No Filter a single item 1
page
No Default: 1 1
size
No Default: 10 10
name
No Fuzzy search: Rule name abc
update_user_name
No Fuzzy search: Operator user name admin
order_by
No enum: 'id', 'name', 'update_time', 'update_by' update_time
order
No enum: 'asc', 'desc' desc
Return data
Body
{
"code": 0,
"data": [
{
"comment": "",
"date_range": [
[
2019,
1,
1
],
[
0,
12,
25
],
[
0,
0,
7
],
[
2020,
1,
1
]
],
"id": 1,
"name": "calendar_x"
},
{
"comment": "nothing",
"date_range": [
[
2019,
1,
1
],
[
2019,
1,
2
],
[
2019,
1,
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
3
],
[
0,
12,
25
],
[
0,
0,
10
]
],
"id": 2,
"name": "test"
},
{
"comment": "nothing",
"date_range": [
[
0,
0,
1
]
],
"id": 3,
"name": "test2"
}
],
"page": {
"count": 3,
"current": 1,
"size": 50,
"total": 1
}
}
Create holiday rule
Basic information
Path: /access/calendar
Method: PUT
Tag: open
Interface description:
Parameter:
name: String, maximum length 40, required
comment: String, maximum length 120, optional
Date_range, required, list, a two-dimensional array.
date = date_range[i] indicates the i-th in a set of settings date[0], date[1], and date[2] indicate year, month, and day, respectively, and 0 is the wildcard character. For example, [0, 0, 1] indicates the 1st day of each month, and [2019, 7, 0] indicates any day in July 2019.
Parameter sample:
{
"name": "test",
"comment": "nothing",
"date_range": [
[
2019,
1,
1
],
[
2019,
1,
2
],
[
0,
12,
25
],
[
0,
0,
10
]
]
}
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Body
Name Type Required Remarks Example Other information
comment string No
date_range array Yes
array[array]
name string Yes
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ comment string No
├─ date_range array No
array[array]
├─ id number No
├─ name string No
page object No
Update holiday rule
Basic information
Path: /access/calendar/{id}
Method: POST
Tag: open
Interface description:
Parameter requirements are the same as those indicated in “Create holiday rule”.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
id
No Holiday rule id, type: int
Body
{
"name": "test4",
"comment": "nothing",
"date_range": [
[
2020,
1,
31
]
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
]
}
Return data
Body
{
"code": 0,
"data": {
"comment": "nothing",
"date_range": [
[
2020,
1,
31
]
],
"id": 4,
"name": "test4"
},
"page": {}
}
Delete holiday rule
Basic information
Path: /access/calendar/{id}
Method: DELETE
Tag: open
Interface description:
Parameter:
extra: Remark information when deleting, length of serialized json should not exceed 1024.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Path parameter
Name Type Required Remarks Example Other information
id
No Holiday rule id, type: int
Body
{
"extra": {
"重复": "年",
"假日": "10月 1日/10月 2日"
}
}
Return data
Body
{
"code": 0,
"data": {},
"page": {}
}
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Host- System Management
Host NTP client control
Basic information
Path: /api/v2/system/ntp-client-service
Method: POST
Tag:
Interface description:
Host NTP client control
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Authorization
Yes
Body
Name Type Required Remarks Example Other information
cmd string No start, stop
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
page object No
Host NTP client configuration
Basic information
Path: /api/v2/system/ntp-client
Method: POST
Tag:
Interface description:
Host NTP client configuration
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Authorization
Yes
Body
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
server_address string No
range_m number No
port number No
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
page object No
Callback face capture image status
Basic information
Path: /api/v2/system/callback/photo
Method: PUT
Tag:
Interface description:
Callback face capture image status
Indicates whether the face capture image is returned upon callback
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Authorization
Yes
Body
Name Type Required Remarks Example Other information
status number No 1: returned, 0: not returned
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
page object No
Set callback address
Basic information
Path: /api/v2/system/callback
Method: PUT
Tag:
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Interface description:
Set callback address
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes
Authorization
Yes
Body
Name Type Required Remarks Example Other information
callback_url string Yes
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
page object No
Host-Recognition
1: 1 authentication
Basic information
Path: /checkin
Method: POST
Tag:
Interface description:
1: 1 authentication
person_id: Identify the personnel id in the library
When person_id is passed in,
○ the verify interface is used to compare the image with the specified person id.
When person_id is not passed in,
○ the recognize interface is used to identify the image and return the personnel id.
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type multipart/form-data Yes
Body
Name Type Required Remarks Example Other information
image file Yes Image
person_id text No Personnel ID, i.e., subject.id 42
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Return data
Body
Name Type Required Remarks Example Other information
code number No
data object No
├─ person_id number No Personnel ID
page object No
Dynamic 1:1 interface
Basic information
Path: /video_verify
Method: POST
Tag:
Interface description:
Description:
Check for personnel in the image or feature from the video screen.
Parameter:
Parameter Type Description
url str Video stream address, for example: rtsp://10.101.1.60/live1.sdp. This parameter must be passed to
url encode before being passed to the server.
rect
(optional) string/JSON
rect indicates the position of the human face, and four numbers are passed in in format of
100,110,120,130 (the four numbers represent left, up, right and down, respectively).If rect is
passed in, the face detection step will be skipped and the face position specified by rect will be
directly used for calculation.
image file Image
Return value description:
{
"face_info": {
"rect": {
"left": 197,
"top": 454,
"right": 752,
"bottom": 1009
},
}
"result": {
"confidence": 92.330423,
"result": {
"track": 7,
"quality": 0.975,
"rect": {
"left": 688,
"top": 394,
"right": 1028,
"bottom": 734
},
"image": "Base64 encoded JPEG image"
},
"recognized": true
},
}
result.confidence represents the confidence level, result.result represents the inspection result, and result.recognized represents
whether it matches the person in the image/feature. Face_info represents the information of the input image.
The interface will first check the faces not earlier than the request time time.gate_reserve, and if any matching face is included in this period, it
will output directly. If not, it will wait for the maximum time.gate_wait. If still not, the most similar human face will be output. These two times are
set to 3 seconds and 2 seconds by default, respectively. This means that the search will be carried out within 5 seconds. If no face is detected during
this period of time, neither result.confidence nor result.result exists.
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type multipart/form-data Yes
Body
Name Type Required Remarks Example Other
information
image file Yes
url text Yes
Video stream address, for example: rtsp://10.101.1.60/live1.sdp.
This parameter must be passed to url encode before being
passed to the server.
rect text No
rect indicates the position of the human face, and four numbers
are passed in in format of 100,110,120,130 (the four numbers
represent left, up, right and down, respectively). If rect is passed
in, the face detection step will be skipped and the face position
specified by rect will be directly used for calculation.
Return data
Body
Name Type Required Remarks Example Other information
result object No
├─ confidence number No
├─ result object No
├─ track number No
├─ image string No
├─ quality number No
├─ rect object No
├─ top number No
├─ right number No
├─ bottom number No
├─ left number No
├─ recognized boolean No
face_info object No
├─ rect object No
├─ top number No
├─ right number No
├─ bottom number No
├─ left number No
Get recognition result
Basic information
Path: /video
Method: GET
Tag:
Interface description:
Note: This request parameter is a GET parameter, for example: ws://192.168.1.50:9000/video?url=rtsp%3A%2F%2F192.169.1.60%2Fuser%3Dadmin%26password%3D%26channel%3D1%26stream%3D0.sdp
Return value description:
The algorithm takes all the images of a person from appearing to leaving in the video as a track. Each track has an id, and the
information of the same track represents one person.
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
There are three possible processes for algorithm processing:
Field Type Description
screen Screen Information identifying the location, available only if type is not gone
person Person Person similar to the one shown in the library, available only when the type is recognized
open_door bool Whether the door is opened, available only when the type is recognized
error string If open_door is false, this field indicates the reason why the door cannot be opened.
type string The type of this information, four types are available: lastface (recognizing), recognized,
unrecognized and gone.
data RecognizeInfo
The underlying information identified by the algorithm. No action needs to be taken if not
necessary. The “track” here indicates track id. Age and gender information will be included here only
when the type is gone.
recognizing...recognizing...gone
○ recognizing...recognizing...recognized,gone
○ recognizing...recognizing...unrecognized,gone
For changes in the values in the data of firmware later than version 2.8:
The value of status changes from a string to a dictionary
'status': {
'recognize_status’:’not_determined’,
'snapshot_status': 'ongoing'
}
Available values for recognize_status include stranger, t_determined, and recognized, respectively, indicating stranger, unknown and recognized,
respectively.
Available values for snapshot_status include ongoing and gone. If it is ongoing, the program sends the real-time face calculation result. If the
recognize_status is not t_determined, it indicates that the judgment has been completed, and the program will not send the subsequent real-time face
calculation result. If it is gone, it means that the track has been completed. The program will send the calculation results of the highest-quality human face.
feature_id is added to person. It is not in use at the moment and its value is fixed at 0.
Since foliage will delay (until the end of track) sending attr separately, the attr field is canceled in the recognition message.
#####Person (fields without a description are the same as those in subject)
| Field | Type | Description |
| :--| :--| :--|
| src | base64 image | Image captured in real time |
#### Returned results
{
"data": {
"status": {
'recognize_status’:'recognized',
'snapshot_status': 'ongoing'
},
"track": 0,
"timestamp": 1474454214,
"face": {
"image": "",
"rect": {
"top": 207,
"right": 913,
"bottom": 775,
"left": 345
}
},
"person": {
"feature_id": 0,
"confidence": 79.35476,
"tag": "{\"subject_type\": 0, \"description\": \"\", \"start_time\": 0, \"birthday\": nul
l, \"id\": 103821, \"remark\": \"\", \"name\": \"\\u5218\\u5b9a\\u5cf0\", \"title\": \"\", \"job_num
ber\": \"\", \"entry_date\": null, \"end_time\": 0, \"department\": \"\", \"avatar\": \"http://10.20
1.105.140:8867/static/upload/photo/2016-09-21/12345f1ea4fff5df02edadffa37c82308bde0e63.jpg\"}",
"id": "103821"
},
"quality": 0.7678973
},
"screen": {
"camera_address": "rtsp://10.101.1.66/live1.sdp",
"allowed_subject_ids": [],
"network_switcher_status": "0",
"box_token": "66666666-f988-4fc9-8a67-6a4c4220dd8a",
"description": "",
"box_heartbeat": 1474454143,
"network_switcher": "10.201.105.47",
"camera_name": "",
"camera_status": "0",
"allow_visitor": true,
"screen_token": "55VkFeQOHzgoIMQe",
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
"network_switcher_token": null,
"box_status": "0",
"allow_all_subjects": true,
"type": 1,
"id": 243,
"camera_position": "\u4e0a\u65b9\u540a\u88c5",
"box_address": "10.201.105.140"
},
"person": {
"src": "data:image/jpeg;base64...",
"remark": "",
"subject_type": 0,
"description": "",
"title": "",
"timestamp": 1474454214,
"start_time": 0,
"avatar": "http://10.201.105.140:8867/static/upload/photo/2016-09-21/12345f1ea4fff5df02eda
dffa37c82308bde0e63.jpg",
"job_number": "",
"birthday": null,
"entry_date": null,
"department": "",
"end_time": 0,
"id": 103821,
"name": "\u5218\u5b9a\u5cf0"
},
"error": "\u5141\u8bb8\u8fdb\u5165",
"open_door": true,
"type": "recognized"
}
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Query
Name Type Required Remarks Example Other
information
url
Yes
Video stream address, for example: rtsp://10.101.1.60/live1.sdp. This
parameter must be passed to url encode before being passed to the
server.
Return data
Static 1:n recognition
Basic information
Path: /recognize
Method: POST
Tag:
Interface description:
1:N recognition
The access address is: {Host IP}:8866{path}
example: http://192.168.1.50:8866/recognize
Request parameters
Headers
Parameter name Parameter value Required Example Remarks
Content-Type multipart/form-data Yes
Body
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Name Type Required Remarks Example Other information
image file Yes Image
screen_token text Yes Device token 735cd0be-779a-4ad1-8de0-b6e768c3c4e4
Return data
Body
Name Type Required Remarks Example Other
information
person object No Identified users, confidence represents similarity,
and tag represents user information.
├─
confidence number No
├─ tag string No
├─ id string No
can_door_open boolean No
Determines whether to open the door after
everything from access control settings, current
time and identified users is factored in.
error number No
0: Access allowed, 1: Visitor not allowed to enter,
2: The visiting time is not due or has passed,
3: Only some employees are allowed to enter
through this door, 4: Instant access control is
disabled, 5: Instant access control is disabled,
6: Settings not found, 7: Stranger, 8: Yellow list
Error Code Definitions
Error code information
Error Code Description
1000 Unknown error
1001 Requested method not allowed
1002 Parameter error
1003 Database error
1004 Operation not allowed
1005 Network error
1006 Invalid theme
1007 Password needs to be changed
1008 Secondary verification error
1009 Face feature extraction service is busy. Please try again
1010 Incorrect image file format
1011 Core down
1012 Deletion forbidden
1013 Unsupported SEARCH MODEL
1014 No permissions
1015 Weak password
1016 Failed to add task
1017 Failed to upload file
1018 Insufficient disk space
2000 User does not exist
2001 Group does not exist
2002 Group already exists
2003 Camera does not exist
2004 Core does not exist
2005 User does not exist
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Error Code Description
2006 Photo does not exist
2007 Host does not exist
2008 Screen does not exist
2009 Company does not exist
2010 Record does not exist
2011 User name already exists
2012 Company already exists
2013 The device does not exist. Please refresh
2014 The device is already registered with another company
2015 Wrong parameter length
2016 Decompression error
2105 Visitor machine does not exist
2106 Visitor machine has been banned
2107 The visiting user does not exist
2108 Failed to send text message
2109 DevicdID already registered
2110 The user does not have permission to access this visitor machine
2111 Wrong photo_id
20011 Host already exists
20012 Host is bound
20013 Host not bound
20014 Inconsistent host and user company
20015 This host has been bound to ** cameras, which has reached the upper limit. Cannot bind more cameras to it
20110 Name already exists
20120 Photo full
20130 Excel file contains errors
20140 File does not exist
20141 Incorrect file format
20150 Email address already exists
20160 Insufficient authorization
20170 Uploaded image is too large
20171 Uploaded image is too small
20172 There are other tasks running. Unable to upload
3000 Incorrect password
3001 Incorrect verification code
3002 The two passwords do not match
3003 Log in
3004 The account is not bound to this host
4001 Failed to get weather information
5000 No face detected
5001 The camera is not configured correctly
5002 Not a valid JSON format
5003 Name already exists
5004 Low face quality
5005 Face brightness is too low
5006 Face brightness is too high
5007 Face brightness is not even. Please provide an image with even illumination on the face
5008 Face angle is too large. Please provide a frontal face image
5009 Face angle is too large. Please provide a frontal face image
5010 Face angle is too large. Please provide a frontal face image
5011 Face is not clear. Please provide a clear face image
5012 The eyes are obstructed. Please provide an unobstructed face image
7/25/2019 Koala API V3.1.0
Koala API V3.1.0
Error Code Description
5013 The face image is too small. Please provide a face image with sufficient pixels
5014 The eyes are obstructed. Please provide an unobstructed face image
5015 Please provide color face images
5016 Face missing, please provide complete face image
6000 The camera is being deleted. Please refresh the page later
6001 You have entered wrong passwords for too many times. Please try again 10 minutes later
6002 You have entered wrong passwords 3 times in a row, and the account has been locked. Please wait 10 minutes before logging in again
6013 Organization already exists
6014 Organization does not exist
6015 Company is not in the organization
6016 The user is not bound to a company
7001 Download queue is not active
7002 All items in the download queue are being stopped
7003 Queue exceeds preset maximum value. Unable to add data
7004 The device is not in the download queue
7005 The device is already in the download queue
7006 Unknown file type
7007 Unknown device upgrade status
7008 Device upgrade file cannot be used
7009 The waiting queue is not empty, cannot download directly
7010 State machine internal error
8001 Type error. Unable to modify status
8002 Upgrade status changes do not conform to the rules
8003 Device type does not match
9001 MD5 validation failed
9002 Decompression failed
9003 Installation package information error
9004 The version you uploaded is outdated. Delete the current version before uploading again
9005 Failed to open upgrade file
9006 Failed to save upgrade file due to insufficient disk space
9007 Failed to save upgrade file. Please check the network
9008 Please ensure that all upgrade tasks are stopped before uploading upgrade package
9009 Please ensure that all upgrade tasks are stopped before deleting
9010 Please stop other upload tasks
9011 File type does not match. Please check and try again
10001 Import personnel. File name is too long
© 2015-2019 Megvii Tech Inc.