Koala API V3.2.0

  • Online-Remote door opening
    • Obtain remote door opening status
    • Set remote door closing status
    • Set remote door opening status
  • Online- Permissions Interface
    • Logout [api]
    • Log in
  • Online- System Management
    • Delete a single access control device
    • Create access control device
    • Update a single access control device
    • Query feature extraction status for the company
    • Query the list of images for which feature extraction failed for the company
    • Get a single access control device
    • Get all hosts
    • Get access control device list
  • Online - Recognition Records
    • Delete a single recognition record
    • History traversal interface
    • Recognition record list
    • Batch delete recognition records
  • Online- Employee Management
    • Upload personnel library
    • Personnel List
    • Personnel head portrait
    • Quality inspection on images to enter the library
    • Create user
    • Create user and upload to library
    • Delete subject library
    • Delete data of a single subject
    • Update data of a single subject
    • Get data of a single subject
  • Online- Attendance Management
    • Attendance record
  • Online- Comprehensive Management
    • Interface for comprehensive statistics on homepage
  • Online- Access Control Group
    • Get access control group list
    • Get access control group and contained access controls
    • Create access control group
    • Update access control group
    • Delete access control group
    • Add access control to access control group
    • Delete access control from access control group
  • Online- Personnel Group
    • Get personnel group list
    • Get personnel group and contained personnel
    • Create personnel group
    • Update personnel group
    • Add personnel to personnel group
    • Delete personnel from personnel group
  • Online- Access Control Permissions
    • Create access control settings
    • Delete access control settings
    • Update access control settings
    • Get access control setting list
  • Online- Access Control Period & Holiday Management
    • Get period list
    • Create period rule
    • Update period rule
    • Delete period rule
    • Get holiday list
    • Create holiday rule
    • Update holiday rule
    • Delete holiday rule
  • Host-System Management-Port 8866
    • Host NTP client control
    • Host NTP client configuration
    • Callback face capture image status
    • Set callback address
  • Host-Auth Permissions API
    • Log in-Port 8866
  • Host-Recognition-Port 8866
    • 1: 1 authentication
    • Dynamic 1:1 interface
    • Get recognition result
    • Static 1:n recognition

Koala API V3.2.0

Release date: 11/27/2019

API Changes

3.2.0 - 3.1.0

Name Path Change
Delete holiday rule DELETE /access/calendar/{id} Update
Query the list of images for which feature extraction failed for the company GET /api/v2/company/photo_extract/fail/list Add
Get access control setting list GET /access/setting/list Update
Create access control settings PUT /access/setting Update
Delete access control settings DELETE /access/setting/list Update
Query feature extraction status for the company GET /api/v2/company/photo_extract/status Add
Set callback address PUT IP: 8866/api/v2/system/callback Update
Callback face capture image status PUT IP: 8866/api/v2/system/callback/photo Update
Logout [api] DELETE /api/v2/auth Update
Create access control device POST /system/screen Update
Create user and upload to library POST /subject/file Update
Update access control settings POST /access/setting/{id} Update
Set remote door opening status POST /api/v2/pad/open/door Add
Set remote door closing status POST /api/v2/pad/close/door Add
Create holiday rule PUT /access/calendar Update
Delete period rule DELETE /access/schedule/{id} Update
Get access control device list POST /system/screen Update
Recognition record list GET /event/events Update
Host NTP client configuration POST IP: 8866/api/v2/system/ntp-client Update
Get all hosts GET /system/boxes Update
Dynamic 1:1 interface POST IP: 8866/video_verify Update
Static 1:n recognition POST IP: 8866/recognize Update
Get holiday list GET /access/calendar/list Update
Get period list GET /access/schedule/list Update
Create period rule PUT /access/schedule Update
History traversal interface POST /event/scan Update
Batch delete recognition records DELETE /event/events Update
Update a single access control device PUT /system/screen/{sid} Update
Log in-Port 8866 POST IP: 8866/api/v2/auth Add
Update holiday rule GET /access/calendar/{id} Update
Log in POST /auth/login Update
Host NTP client control POST IP: 8866/api/v2/system/ntp-client-service Update
Update period rule POST /access/schedule/{id} Update
Obtain remote door opening status GET /api/v2/pad/open/door Add

Document History

  • Koala API V3.1.0

Online-Remote door opening

Obtain remote door opening status

Basic information

Path: /api/v2/pad/open/door

Method: GET

Tag: Koala 3.2.0

Interface description:

0-Closing status
1-Opening status

Request parameters

Headers

Parameter name Parameter value Required Example Remarks

Query

Name Type Required Remarks Example Other Information
token Yes Unique ID of access control device 7cdd990446913f3c
open_from No 0: Opened by access control device; 1: Opened by relay; 2: Final status (successful when opened by either an access control device or a relay) 0

Return data

Body

{ "code": 0, "data": { "state": 0, "timestamp": 1566471211000 }, "page": {} }

Set remote door closing status

Basic information

Path: /api/v2/pad/close/door

Method: POST

Tag: Koala 3.2.0

Interface description:

Sets door opening status to 0

open_from
0: Closed by access control device
1: Closed by relay
2: Closed by both

Request parameters

Headers

Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes

Body

{ "token": "7cdd990446913f3c", "open_from": 0 }

Return data

Body

{ "code": 0, "data": {}, "page": {} }

Set remote door opening status

Basic information

Path: /api/v2/pad/open/door

Method: POST

Tag: Koala 3.2.0

Interface description:

Sets the door opening status to 1. After setting the door opening status, the door closing status interface needs to be called to close the door, otherwise the door will not close.

Request parameters

Headers

Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes

Body

{ "token": "7cdd990446913f3c" }

Return data

Body

{ "code": 0, "data": {}, "page": {} }

Online- Permissions Interface

Logout [api]

Basic information

Path: /api/v2/auth

Method: DELETE

Tag: Open, Koala3.2.0

Interface description:

Exits from logout interface, part of api v2.
In contrast to using /auth/logout in the old version, delete is used for the HTTP method, and no redirect operation is provided.

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

Log in

Basic information

Path: /auth/login

Method: POST

Tag: Open, Koala3.1.0, and Koala3.2.0

Interface description:

Sign in and get a cookie, and this cookie must be brought in when requesting all subsequent interfaces.

Please log in with the company's business account, not the [email protected] account. The login session is valid for 1 hour.
If you log in with the API, set the user-agent to "Koala Admin" in the request header, otherwise you cannot log in successfully.

If you use the auth_token parameter during login, the API will return an auth_token value. With this value, you can directly use subsequent API calls without logging in (auth_token is valid for 1 hour).
To use auth_token, add "Authorization: e3f14076-571e-4243-b315-bbc4d34547d4"

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 boolean 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_reset boolean No
├─ permission array No array[string]
├─ verify boolean No
├─ auth_token string No
├─ company_id number No
├─ role_id number No
├─ organization_id null No
├─ avatar string No
├─ lang_code string 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
├─ 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

Tag: Open, Koala3.1.0, and Koala3.2.0

Interface description:

Creates a video stream access control device
When box_token and box_id are passed in at the same time, box_token will be used first.

B3r updates in Koala 3.2.0:
1. If the bound box is b3r, the video stream address will be checked, and it must begin with rtsp://; the type of the bound relay must be TCP-KP-C2 or not bound, otherwise a parameter error will be reported.
2. If the device added changes to b3r permissions, the increase in the number of permissions will be checked. Up to 20 personnel groups are available for a single device, 64 for the entire b3r, with a maximum of 100 permissions.

Request parameters

Headers

Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes Either application/json or application/x-www-form-urlencoded can be used.

Body

Name Type Required Remarks Example Other Information
network_switcher_drive number No Switch type
box_id number Yes Binds to the host ID. Either box_id or box_token must be provided. If both are provided, use box_token.
box_token string Yes Binds to the host token with a length of 128. Either box_id or box_token must be provided. If both are provided, use box_token.
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
wg_number string No Wiegand card code
group_id number No Id of access control group
extra_id string No Unique identifier
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
├─ extra_id string No Unique identifier
├─ network_switcher_token null No Switch token
├─ box_address string No Host address
├─ is_select number No Whether to bind host
├─ wg_number string No Wiegand card code
├─ 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

Update a single access control device

Basic information

Path: /system/screen/{sid}

Method: PUT

Tag: Open, Koala3.1.0, and Koala3.2.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.

B3r updates in Koala 3.2.0:
1. If the bound box is b3r, the video stream address will be checked, and it must begin with rtsp://; the type of the bound relay must be TCP-KP-C2 or not bound, otherwise a parameter error will be reported.
2. Changes to the b3r device will be entered into the queue and asynchronously processed.
3. If the device edit made changes to b3r permissions, the increase in the number of permissions will be checked. Up to 20 personnel groups are available for a single device, 64 for the entire b3r, with a maximum of 100 permissions.

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
├─ 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

Query feature extraction status for the company

Basic information

Path: /api/v2/company/photo_extract/status

Method: GET

Tag: Koala 3.2.0

Interface description:

Query feature extraction status for the company

After modifications have been asynchronously checked and added to the library and also feature extracted, their status must be extracted via the API.

Request parameters

Headers

Parameter name Parameter value Required Example Remarks
Authorization Yes

Return data

Body

Name Type Required Remarks Example Other Information
timecost number No
code number No
data object No
├─ photo_all number No No of existing libraries
├─ photo_extract_ok number No No. of completed feature extractions is done
page object No

Query the list of images for which feature extraction failed for the company

Basic information

Path: /api/v2/company/photo_extract/fail/list

Method: GET

Tag: Koala 3.2.0

Interface description:

Query the list of images for which feature extraction failed for the company

Request parameters

Headers

Parameter name Parameter value Required Example Remarks

Query

Name Type Required Remarks Example Other Information
page No
size No
username No User's real name (full or partial)

Return data

Body

Name Type Required Remarks Example Other Information
timecost number No
code number No
data object No
├─ photo_list array No array[object]
├─ photo_id number No Same as ID
├─ url string No
├─ subject_id number No
├─ company_id number No
├─ subject_name string No User's real name
├─ id number No
├─ version number No
├─ quality null No
├─ origin_url null No
page object No
├─ count number No
├─ current number No
├─ total number No
├─ size number 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
├─ 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, and Koala3.2.0

Interface description:

Get all available local hosts.
Definitions of the type field on the 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 Static recognition threshold
├─ yaw number No Horizontal angle
├─ blurriness number No Fuzziness
├─ fmp number No Liveness switch: 1 open; 0 close
├─ unthreshold number No Stranger threshold
├─ facemin number No Minimum face
├─ pitch number No Vertical angle
├─ threshold number No Dynamic recognition threshold
├─ roll number No Rotation angle
├─ 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
├─ box_type string No Host type: 1 is a nuc host; 2 is a b3r host
├─ status string No Host status: 0 normal; 1 failure
├─ box_address string No Host address
├─ heartbeat number No Heartbeat timestamp
├─ all_screens array No All screens bound to host array[object]
├─ 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, and Koala3.2.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

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

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, and Koala3.2.0

Interface description:

Interface use

First use

Parameters required
  • event_type: Event type: All types are recorded by default, 0: Recognition records, 1: Unrecognized records, 2: Opening the door with password, 3: Opening the door remotely
  • 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, the cursor returned in the result is used for the next request.

Parameters required
  • cursor: A cursor parameter is returned every time a request is made. The cursor in the data returned by the last request is required for the next request.cursor
  • 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

Body

Name Type Required Remarks Example Other Information
event_type text No Type of records: 0: Recognition records, 1: Unrecognized records, 2: Opening the door with password, 3: Opening the door remotely 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, and Koala3.2.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
    • 3: Open door remotely
  • 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
    • 5: Opening the door with password, i.e., event_type=2
    • 6: Opening the door remotely, i.e., event_type=3
  • 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, which is used for front-end display, is available. When it is not deleted, more screen fields, which are not used for front-end display, will be available.

{ "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, subject_type fields, which are also used for front-end display, are available. 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, "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
├─ total number No
├─ size number No

Batch delete recognition records

Basic information

Path: /event/events

Method: DELETE

Tag: Open, Koala3.1.0, and Koala3.2.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: Opening the door with password
    • 3: Opening door remotely
  • 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
    • 5: Opening the door with password, i.e., event_type=2
    • 6: Opening the door remotely, i.e., event_type=3
  • 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

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. The images uploaded cannot be identical.
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
├─ 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.
Employee query

Change log

  • 3.2.0
    • Added a search field: extra_id
    • Added return fields: extra_id, wg_number

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
extra_id No Unique ID

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
├─ extra_id string No Unique ID
├─ 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
├─ entry_date null No Entry date
├─ wg_number string No Wiegand card code
├─ department string No Department
├─ email string No Email address
├─ end_time number No Visitor end time
├─ password_reset 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 example usage: 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.jpg", "url": "http://10.169.2.153/static/upload/avatar/2019-05-16/v2_50414ce89d5834155a5513e71d41412f67622cd4.jpg" }, "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: Koala 3.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

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:

API 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 into photo_ids.

Avatar: Version 3.1.0 of avatar
can pass in images encoded with base64 (compatible with previous encoding methods), in the format of: data:image/jpeg;base64 (base64 codes, jpeg used as an example here, can be replaced with whichever is applicable);
the path of the head portrait can also be passed. For the path format, see the return value of the /subject/avatar API.



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.

Change log

  • 3.2.0
    • Added fields: Wg_number (Wiegand card code), extra_id (unique ID)

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
extra_id string No Unique ID with a length of 40
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.
wg_number string No Wiegand card code with a length of 20
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
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
├─ extra_id string No
├─ 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
├─ wg_number string No
├─ department string No Department
├─ email string No Email address
├─ end_time number No Visitor end time
├─ password_reset 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

Create user and upload to library

Basic information

Path: /subject/file

Method: POST

Tag: Koala 3.1.0, open, Koala 3.2.0

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.

Change log

  • 3.2.0
    • Added fields: Extra_id (unique ID), wg_number (Wiegand card code)

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
extra_id text No Unique ID with a length of 40
wg_number text No Wiegand card code with a length of 20

Return data

Body

Name Type Required Remarks Example Other Information
code number No
data object No
├─ subject_type number No Type
├─ extra_id string No
├─ 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
├─ wg_number string No
├─ department string No Department
├─ email string No Email address
├─ end_time number No Visitor end time
├─ password_reset 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

Body

Name Type Required Remarks Example Other Information
subject_id text Yes Type: Integer

Return data

Body

Name Type Required Remarks Example Other Information
code number No
data object No
page object No

Delete data of a single subject

Basic information

Path: /subject/{sid}

Method: DELETE

Tag: Open, Koala3.1.0

Interface description:

API for deleting subjects
For 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
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:

API for updating subjects
For 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: images encoded with base64 (i.e., the old usage mode is also supported) can be passed in via the head portrait path see: /subject/avatar.

Change log

  • 3.2.0
    • Added fields: Extra_id (unique ID), wg_number (Wiegand card code)

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
extra_id string No Length: 40
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
wg_number string No Length: 20
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
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
├─ extra_id string 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
├─ wg_number string No
├─ department string No
├─ email string No
├─ end_time number No
├─ password_reset 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

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
├─ extra_id string 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
├─ wg_number string No
├─ department string No
├─ email string No
├─ end_time number No
├─ password_reset 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

Online- Attendance Management

Attendance record

Basic information

Path: /attendance/records

Method: GET

Tag: Open, Koala3.1.0

Interface description:

Attendance record interface
Valid values for clock_in, clock_out

  • 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, "total": 8712 } }

Request parameters

Headers

Parameter name Parameter value Required Example Remarks

Query

Name Type Required Remarks Example Other Information
start_time No Start time, type: Integer
end_time No End time, type: Integer
user_name No Full name of user
department No Department
subject_id No Employee id, type: Integer
page No Page number, type: Integer 1
size No 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
├─ 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:

Request parameters

Headers

Parameter name Parameter value Required Example Remarks

Query

Name Type Required Remarks Example Other Information
page No Paging number, 1 by default (Page 1) 1
size No Maximum items per page, default is 10 10
name No Group name with a maximum length of 40 abc
comment No Group comments with a maximum length of 120 abc
update_user_name No Updated by [email protected]
order_by No Sorted by: ID, group name, updated on, updated by, and number of screens in a group (enum): 'id', 'name', 'update_time', 'update_by', or 'screens_count' update_time
order No enum: 'asc' is ascending order; 'desc' is descending order. 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:

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

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" }

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

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]

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 } }

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, "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
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", "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

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, Koala3.2.0

Interface description:

Koala 3.2 is integrated with the B3R device.
If the new access control permissions are used by B3R, the permissions will be checked to see whether the total quantity exceeds 100. If so, these permissions will be created.
If the number of personnel groups for the access control permissions used by B3R exceed 64, these permissions will not be created.
If the time periods for the access control permissions used by B3R exceed 100, these permissions will not be created.
If the holidays for the access control permissions used by B3R exceed 100, these permissions will not be created.

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 Comments with a maximum length of 120
name string Yes Name of access control rule, with a maximum length of 40
calendar_ids array No Holiday IDs, an empty list can be passed array[integer]
screen_group_ids array No Access control group IDs, an empty list can be passed array[integer]
schedule_ids array No Period IDs, an empty list can be passed array[integer]
subject_group_id integer No User group ID. Special values are 0 (all employees) and 1 (all visitors).

Return data

Body

Name Type Required Remarks Example Other Information
timecost integer Yes
code integer Yes
data object Yes
├─ status integer No Permission status: 1 enabled; 2: disabled
├─ subject_groups object No Personnel group information
├─ comment string No
├─ subject_count integer No Number of persons
├─ update_time number No
├─ subject_type integer No Personnel group type: 0 employee group; 1 visitor group
├─ name string No Personnel group name
├─ update_by string No
├─ id integer No Personnel group ID
├─ update_time number No
├─ name string No Permission name
├─ screen_groups array No Access control group information array[object]
├─ comment string No
├─ update_by string No
├─ update_time number No
├─ id integer No Access control group ID
├─ name string No Access control group name
├─ calendar_ids array No Holiday ID array[integer]
├─ schedule_ids array No Period ID array[integer]
├─ update_by string No
├─ id integer No Permission ID
page object Yes

Delete access control settings

Basic information

Path: /access/setting/list

Method: DELETE

Tag: Open, Koala3.2.0

Interface description:

This interface is the same as the one for batch deletion.
Parameter:
extra: Comments for deletion are used by the history query interface. It is recommended to add a comment, otherwise problems may arise during history query.

Request parameters

Headers

Parameter name Parameter value Required Example Remarks
Content-Type application/json Yes

Body

Name Type Required Remarks Example Other Information

Return data

Body

Name Type Required Remarks Example Other Information
timecost integer Yes
code integer Yes
data object Yes
page object Yes

Update access control settings

Basic information

Path: /access/setting/{id}

Method: POST

Tag: Open, Koala3.2.0

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: A string with the maximum length of 120, optional
subject_group_id: int, which is optional. Special values are 0 (all employees) and 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 Type Required Remarks Example Other Information
status integer No 1: enabled; 2: disabled
comment string No Maximum: 120
name string No Maximum: 40
calendar_ids array No array[integer]
screen_group_ids array No array[integer]
schedule_ids array No array[integer]
subject_group_id integer No

Return data

Body

Name Type Required Remarks Example Other Information
timecost integer Yes
code integer Yes
data object Yes
├─ status integer No
├─ name string No
├─ screen_groups array No array[object]
├─ calendar_ids array No array[integer]
├─ scheduls_ids array No array[integer]
├─ subject_group object No
├─ id integer No
page object Yes

Get access control setting list

Basic information

Path: /access/setting/list

Method: GET

Tag: Open, Koala3.2.0

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

Name Type Required Remarks Example Other Information
timecost string Yes
code string Yes
data array Yes array[object]
├─ comment string No
├─ status integer No
├─ update_time number No
├─ name string No
├─ screen_groups array No array[object]
├─ calendar_ids array No array[integer]
├─ schedule_ids array No array[integer]
├─ update_by string No
├─ subject_group object No
├─ id integer No
page object Yes
├─ count integer No
├─ current integer No
├─ total integer No
├─ size integer No

Online- Access Control Period & Holiday Management

Get period list

Basic information

Path: /access/schedule/list

Method: GET

Tag: Open, Koala3.2.0

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 50
id No Filter a single item 1
name No Fuzzy search: Period name abc
update_user_name No Fuzzy search: Operator user name admin
order_by No enum: 'id', 'name', 'update_time' (default), or 'update_by' update_time
order No enum: 'asc', 'desc' (default) desc
comment No Fuzzy search: remarks

Return data

Body

Name Type Required Remarks Example Other Information
timecost integer Yes
code integer Yes
data array Yes array[object]
├─ comment string No
├─ name string No
├─ start_time string No YYYY-MM-DD
├─ time_range array No array[string]
├─ end_time string No YYYY-MM-DD
├─ id integer No
page object Yes
├─ count integer No
├─ current integer No
├─ total integer No
├─ size integer No

Create period rule

Basic information

Path: /access/schedule

Method: PUT

Tag: Open, Koala3.2.0

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. Up to 3 periods can be set for each day.
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, 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 Maximum: 120
start_time string No The current day is the default value
end_time string Yes
name string Yes Maximum: 40
time_range array Yes array[array]

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, Koala3.2.0

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 Type Required Remarks Example Other Information
comment string No Maximum: 120
start_time string No
end_time string No
name string No Maximum: 40
time_range array No array[string]

Return data

Body

Name Type Required Remarks Example Other Information
timecost integer Yes
code string Yes
data object Yes
├─ comment string No
├─ name string No
├─ start_time string No
├─ time_range array No array[string]
├─ end_time string No
├─ id integer No
page object Yes

Delete period rule

Basic information

Path: /access/schedule/{id}

Method: DELETE

Tag: Open, Koala3.2.0

Interface description:

Parameter:
extra: Comments for deletion are used by the history query interface. It is recommended to add a comment, otherwise problems may arise during history query.
For example: "extra": {"start_time": "2019-10-01~2019-10-31"}

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

Name Type Required Remarks Example Other Information
extra object Yes
├─ start_time string No Start/end time

Return data

Body

Name Type Required Remarks Example Other Information
timecost integer Yes
code integer Yes
data object Yes
page object Yes

Get holiday list

Basic information

Path: /access/calendar/list

Method: GET

Tag: Open, Koala3.2.0

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: Holiday name abc
update_user_name No Fuzzy search: Operator user name admin
order_by No enum: 'id', 'name', 'update_time', or 'update_by' update_time
order No enum: 'asc', 'desc' desc
comment No Fuzzy search: Information on remarks

Return data

Body

Name Type Required Remarks Example Other Information
timecost string Yes
code string Yes
data array Yes array[object]
├─ date_range array No array[string]
├─ comment string No
├─ id integer No
├─ name string No
page object Yes
├─ count integer No
├─ current integer No
├─ total integer No
├─ size integer No

Create holiday rule

Basic information

Path: /access/calendar

Method: PUT

Tag: Open, Koala3.2.0

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 element 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 ] ] }

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 Maximum: 120
date_range array Yes array[array]
name string Yes Maximum: 40

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, Koala3.2.0

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 Type Required Remarks Example Other Information
comment string No Maximum: 120
date_range array No array[array]
name string No Maximum: 40

Return data

Body

Name Type Required Remarks Example Other Information
timecost integer Yes
code integer Yes
data object Yes
├─ date_range array No array[string]
├─ comment string No
├─ id integer No
├─ name string No
page object Yes
├─ count integer No
├─ current integer No
├─ total integer No
├─ size integer No

Delete holiday rule

Basic information

Path: /access/calendar/{id}

Method: DELETE

Tag: Open, Koala3.2.0

Interface description:

Parameter:
extra: Comments for deletion are used by the history query interface. It is recommended to add a comment, otherwise problems may arise during history query.

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 Type Required Remarks Example Other Information
extra object Yes
├─ comment string No
├─ update_time number No
├─ repeat string No Repeats annually, repeats monthly, or does not repeat
├─ name string No
├─ date_range array No array[string]
├─ update_by string No
├─ id integer No

Return data

Body

Name Type Required Remarks Example Other Information
timecost integer Yes
code integer Yes
data object Yes
page object Yes

Host-System Management-Port 8866

Host NTP client control

Basic information

Path: IP: 8866/api/v2/system/ntp-client-service

Method: POST

Tag: Koala 3.1.0

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 Yes 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: IP: 8866/api/v2/system/ntp-client

Method: POST

Tag: Koala 3.1.0

Interface description:

Host NTP client configuration

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
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: IP: 8866/api/v2/system/callback/photo

Method: PUT

Tag: Koala 3.1.0

Interface description:

Face capture image status callback
Indicates whether the face capture image was 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 Yes 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: IP: 8866/api/v2/system/callback

Method: PUT

Tag: Koala 3.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-Auth Permissions API

Log in-Port 8866

Basic information

Path: IP: 8866/api/v2/auth

Method: POST

Tag:

Interface description:

Login interface used by the host
Returns the request of verifying other API permissions for the user with auth_token after registration Besides session configuration after a request is sent, a local file will be written for the user to keep a record of the permission information of auth_token.

The path for the API is /api/v2/auth. There are APIs with different port numbers under the same path, but ports with the same path are not allowed in the yapi system. As a result _t is added, which is not actually necessary.

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
password string Yes

Return data

Body

Name Type Required Remarks Example Other Information
code number No
data object No
├─ auth_token string No

Host-Recognition-Port 8866

1: 1 authentication

Basic information

Path: IP: 8866/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

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: IP: 8866/video_verify

Method: POST

Tag: Koala 3.1.0

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. Four numbers are passed in the 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 check the faces recorded after the request time time.gate_reserve first, and if any matching face is found in this period, it will be output directly. If not, it will wait for the maximum time.gate_wait. If a match was still not found, 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 there will be no result.confidence nor result.result.

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 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: IP: 8866/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:

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 There are four message types: lastface (recognizing), recognized, unrecognized, and gone (recognition finished)
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.
  • 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.
  • There are three possible processes for algorithm processing:
    • 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' }





Since foliage will delay (until the end of track) sending attr separately, the attr field is canceled in the recognition message.

Example of 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\": null, \"id\": 103821, \"remark\": \"\", \"name\": \"\\u5218\\u5b9a\\u5cf0\", \"title\": \"\", \"job_number\": \"\", \"entry_date\": null, \"end_time\": 0, \"department\": \"\", \"avatar\": \"http://10.201.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", "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/12345f1ea4fff5df02edadffa37c82308bde0e63.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

Body

Name Type Required Remarks Example Other Information
type string No There are four message types: lastface (recognizing), recognized, unrecognized, and gone (recognition finished)
screen object No
├─ network_switcher_status string No
├─ box_token string No
├─ description string No
├─ box_heartbeat number No
├─ network_switcher string No
├─ type number No
├─ camera_name string No
├─ camera_status string No
├─ allow_visitor boolean No
├─ screen_token string No
├─ network_switcher_token null No
├─ allowed_subject_ids array No array[string]
├─ camera_position string No
├─ allow_all_subjects boolean No
├─ box_status string No
├─ id number No
├─ camera_address string No
├─ box_address string No
person object No
├─ src string No base64 image, captured in real time |
├─ remark string No
├─ subject_type number No
├─ description string No
├─ name string No
├─ title string No
├─ timestamp number No
├─ start_time number No
├─ id number No
├─ feature_id string No feature_id is added to person. It is not in use at the moment and its value is fixed at 0.
├─ birthday null No
├─ avatar string No
├─ department string No
├─ end_time number No
├─ job_number string No
├─ entry_date null No
error string No If open_door is false, this field indicates the reason why the door cannot be opened.
open_door boolean No Whether the door is opened, available only when the type is recognized
data object No 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.
├─ status object No
├─ recognize_status string No Available values include stranger, t_determined, and recognized, which represent stranger, unknown and recognized, respectively.
├─ snapshot_status string No Available values include ongoing and gone. If it is ongoing, the program will send 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.
├─ track number No
├─ timestamp number No
├─ face object No
├─ image string No
├─ rect object No
├─ top number No
├─ right number No
├─ left number No
├─ bottom number No
├─ person object No Person similar to the one shown in the library, available only when the type is recognized
├─ feature_id number No
├─ confidence number No
├─ tag string No
├─ id string No
├─ quality number No

Static 1:n recognition

Basic information

Path: IP: 8866/recognize

Method: POST

Tag: Koala 3.1.0

Interface description:

1:N recognition

The access address is: {Host IP}:8866{path}
For 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

Name Type Required Remarks Example Other Information
image file Yes Image
screen_token text No 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

© 2015-2019 Megvii Tech Inc.