Query Access Control Records

Last Updated on : 2023-01-12 07:16:23download

This topic describes the API operations used to query access control records.

Request method API Description
GET /v1.0/iot-02/building/access-record/actions/event-filter Filter event types in the list of access control records
POST /v1.0/iot-02/building/access-record Query the list of access control records

Filter event types

Functional description

Filter event types in the list of access control records.

API endpoint

GET /v1.0/iot-02/building/access-record/actions/event-filter

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. true

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: succeeded.
  • false: failed.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

Sample request

GET /v1.0/iot-02/building/access-record/actions/event-filter?project_id=0l9sT07CLN

Sample response

{
    "result": [
        {
            "children": [
                {
                    "children": [
                        {
                            "children": [],
                            "event_code": "1002",
                            "i18n_code": "1123003023",
                            "node_id": "51",
                            "parent_id": "35",
                            "title": "Valid access with a password",
                            "type": "event",
                            "value": "51"
                        },
                        {
                            "children": [],
                            "event_code": "1003",
                            "i18n_code": "1123003024",
                            "node_id": "52",
                            "parent_id": "35",
                            "title": "Valid access with a card",
                            "type": "event",
                            "value": "52"
                        },
                        {
                            "children": [],
                            "event_code": "1004",
                            "i18n_code": "1123003025",
                            "node_id": "53",
                            "parent_id": "35",
                            "title": "Valid access with face recognition",
                            "type": "event",
                            "value": "53"
                        }
                    ],
                    "event_code": "",
                    "i18n_code": "1123003004",
                    "node_id": "35",
                    "parent_id": "30",
                    "title": "Access control"
                    "type": "category",
                    "value": "35"
                },
                {
                    "children": [
                        {
                            "children": [],
                            "event_code": "1033",
                            "i18n_code": "1123003027",
                            "node_id": "55",
                            "parent_id": "36",
                            "title": "Unlock with card",
                            "type": "event",
                            "value": "55"
                        },
                        {
                            "children": [],
                            "event_code": "1034",
                            "i18n_code": "1123003028",
                            "node_id": "56",
                            "parent_id": "36",
                            "title": "Unlock with password",
                            "type": "event",
                            "value": "56"
                        }
                    ],
                    "event_code": "",
                    "i18n_code": "1123003010",
                    "node_id": "36",
                    "parent_id": "30",
                    "title": "Smart lock",
                    "type": "category",
                    "value": "36"
                }
            ],
            "event_code": "",
            "i18n_code": "1123003006",
            "node_id": "30",
            "parent_id": "28",
            "title": "Valid access event",
            "type": "category",
            "value": "30"
        },
        {
            "children": [
                {
                    "children": [
                        {
                            "children": [],
                            "event_code": "1005",
                            "i18n_code": "1123003029",
                            "node_id": "57",
                            "parent_id": "37",
                            "title": "Invalid access",
                            "type": "event",
                            "value": "57"
                        }
                    ],
                    "event_code": "",
                    "i18n_code": "1123003004",
                    "node_id": "37",
                    "parent_id": "31",
                    "title": "Access control"
                    "type": "category",
                    "value": "37"
                },
                {
                    "children": [
                        {
                            "children": [],
                            "event_code": "1030",
                            "i18n_code": "1123003030",
                            "node_id": "58",
                            "parent_id": "38",
                            "title": "Card attempt alert",
                            "type": "event",
                            "value": "58"
                        },
                        {
                            "children": [],
                            "event_code": "1031",
                            "i18n_code": "1123003031",
                            "node_id": "59",
                            "parent_id": "38",
                            "title": "Password attempt alert",
                            "type": "event",
                            "value": "59"
                        }
                    ],
                    "event_code": "",
                    "i18n_code": "1123003010",
                    "node_id": "38",
                    "parent_id": "31",
                    "title": "Smart lock",
                    "type": "category",
                    "value": "38"
                }
            ],
            "event_code": "",
            "i18n_code": "1123003007",
            "node_id": "31",
            "parent_id": "28",
            "title": "Invalid access event",
            "type": "category",
            "value": "31"
        }
    ],
    "success": true,
    "t": 1664187322182,
    "tid": "214276763d8411ed84fd2237f0528b74"
}

Query access control records

Functional description

Query the list of access control records.

API endpoint

POST /v1.0/iot-02/building/access-record

Request parameters

Parameter Parameter type Type Required Description Example
project_id body String false The project ID. Lo4KO88gXF
access_start_time body Long false The start time of access. 28817
access_end_time body Long false The end time of access. 814559
name body String false The name. ph08hnxvz2
sex body Integer false The gender. 145371
mobile body String false The mobile phone number. w5AkHvvyOk
structure_name body String false The organization name. cSNFM8vULs
person_code body String false The work number of the specified person. MdfBBZQ1yf
access_direction body Integer false The access direction. Valid values:
1: enter
2: exit
986048
access_control_channel_name body String false The name of the specified entrance and exit. RSRd4tbrUT
access_channel_position_path body String false The installation location of the specified entrance and exit. B9enQD9nQM
business_device_name body String false The name of the specified access control device. GZCM2s6QyN
certificate body String false The access method.
1: card
2: face
3: fingerprint
i5rPql2S4T
event_node_ids body String[] false The access event. Q7y38SBgiv
page body Integer false The total number of returned pages. 251001
page_size body Integer false The number of items returned on each page. 534449
need_log body Boolean false Specifies whether to keep a log. true

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: succeeded.
  • false: failed.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

{
  "total": "Integer",
  "list": [
    {
      "access_record_id": "String // The primary key of an access record",
      "access_time": "Long // The access time",
      "person_id": "String // The ID of the specified person",
      "name": "String // The name",
      "sex": "Integer // The gender",
      "mobile_country": "String // The country code",
      "mobile": "String // The mobile phone number",
      "structure_name": "String // The organization name",
      "person_code": "String // The work number",
      "access_direction": "Integer // The access direction. 0: enter, 1: exit",
      "access_control_channel_name": "String // The name of the specified entrance and exit",
      "access_control_channel_no": "Integer // The channel number of the specified entrance and exit",
      "access_channel_position_path": "String // The installation location of the specified entrance and exit",
      "business_device_name": "String // The device name",
      "access_type": "Integer // The access method. 1: card, 2: password, 4: face recognition, 9: remote control",
      "event_name": "String // The access event"
    }
  ],
  "has_more": "Boolean"
}

Sample request

POST /v1.0/iot-02/building/access-record
{
  "project_id": "Lo4KO88***",
  "access_start_time": 28817,
  "access_end_time": 814559,
  "name": "ph08hnx***",
  "sex": 145371,
  "mobile": "w5AkHvv***k",
  "structure_name": "cSNFM8v***",
  "person_code": "MdfBBZQ***",
  "access_direction": 986048,
  "access_control_channel_name": "RSRd4tb***",
  "access_channel_position_path": "B9enQD9n***",
  "business_device_name": "GZCM2s6***",
  "certificate": "i5rPql2S4T",
  "event_node_ids": [
    "Q7y38SBgiv"
  ],
  "page": 251001,
  "page_size": 534449,
  "need_log": true
}

Sample response

{
    "result": {
        "list": [
            {
                "access_channel_position_path": "Center-11",
                "access_control_channel_name": "Entrance and Exit 605c",
                "access_control_channel_no": 1,
                "access_direction": 0,
                "access_record_id": "1568067517614698***",
                "access_time": 1662691403186,
                "access_type": 0,
                "business_device_name": "Access Control Device 605c",
                "event_name": "Invalid access",
                "mobile": "",
                "mobile_country": "",
                "name": "",
                "person_code": "",
                "person_id": "",
                "structure_name": ""
            }
        ],
        "total": 209
    },
    "success": true,
    "t": 1664187427006,
    "tid": "5fbbfa563d8411ed84fd2237f0528b74"
}

Error codes

The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.

Error code Description
500 A system error has occurred while processing your request.