logo

API Docs

    Users

history

History

The history API for viewing lock opening and closing history is a feature that allows users to view a detailed log of when their lock was opened and closed. This feature can be accessed through a web portal or mobile app, and allows users to view the history of their lock's activity in real-time.

With this feature, users can view the date and time of each lock event, along with the user who initiated the event (if the lock is connected to a user account). This information can be used to see who has been accessing the lock, as well as when the lock was last accessed.

Additionally, the history API can also provide information about the type of event that occurred. For example, whether it was opened with a fingerprint, a passcode, a Bluetooth connection, or remotely through the mobile app. This information can be used to identify patterns in usage and troubleshoot any issues that may arise.

The history API also allows users to filter the events by date range and event type, making it easy to find specific events and analyze the usage of the lock over time.

Overall, the History API for viewing lock opening and closing history is a powerful tool that provides users with a detailed and easily accessible log of their lock's activity, helping to ensure the security of their property and providing valuable insights into how the lock is being used.


GET

History

{{host}}/api/history?lockuserid={{lockuserid}}&type=0&pagenumber=1&limit=10

Description:

This endpoint retrieves a list of history records in the system.

Query Parameters:

  • lockuserid: The id of the lock user. (required)
  • type: A filter for the type of history to retrieve (0 for all, 1 for fingerprint, 2 for application, 3 for internet, 4 for shared, 5 for dashboard, and 6 for key). (required)
  • pagenumber: The page number of the results to retrieve. (required)
  • limit: The maximum number of results to retrieve per page. (required)

Response:

Copy

{ "status": 1, "msg": "", "analytics": { "total": 259, "fingerprint": 78, "application": 0, "internet": 0, "shared": 0, "dashboard": 22, "key": 159 }, "totalPage": 26, "currentPage": "1", "unlockHistory": [ { "lockname": "EM27020D", "lock_open_status": 1, "user": "admin", "datetime": "2023-01-21 18:41:15", "type": 6, "location": { "latitude": null, "longitude": null }, "created_date": "2023-01-21 18:41:16" }, //... ] }
  • status: A status code indicating the success or failure of the request. 1 indicates success, and 0 indicates failure.
  • msg: A message indicating the result of the request.
  • analytics: An object containing the total number of history records and the breakdown by type.
  • totalPage: The total number of pages of results.
  • currentPage: The current page of results being returned.
  • unlockHistory: An array of objects representing the history records. Each object includes the following fields:
    • lockname: The name of the lock.
    • lock_open_status: A boolean indicating whether the lock was opened (1) or closed (0).
    • user: The user who unlocked the lock.
    • datetime: The date and time the lock was unlocked.
    • type: The type of unlock (1 for fingerprint, 2 for application, 3 for internet, 4 for shared, 5 for dashboard, and 6 for key).
    • location: An object representing the location of the lock when it was unlocked.
    • created_date: The date and time the history record was created.