HikCentral Middleware Admin

Port 3000 - Local Database + HikCentral Integration

Residents

ID Name Email Phone Type HikCentral ID Status Actions

Manual Operations

📝 Create New Resident: Fill in the required information to create a new resident in both the local database and HikCentral system.

📋 Resident Information

This will be split into family name and given name for HikCentral Please enter a valid name
Must be a valid email address Please enter a valid email address
Optional - for contact purposes Please enter a valid phone number
Community identifier for organization Please enter community name

🏠 Unit & Access Details

Type of access and permissions
Unique identifier for the unit Please enter unit ID
Start date for access permissions Please select a valid start date
End date for access permissions - can't exceed 10 years Please select a valid end date
🔑 Get Resident Identity: Retrieve a resident's dynamic QR code for access. Requires resident to be synced with HikCentral.

📍 Resident Selection

The unique identifier for the resident Please enter owner ID
Optional - unit identifier
QR Code Preview
Will display actual QR code when generated

Dynamic QR Code

This QR code provides temporary access for the resident

📋 Identity Information

Fill in the form above and click "Get Identity" to retrieve resident information and QR code.
👤 Generate Visitor QR: Create a temporary QR code for visitors. Requires resident to be synced with HikCentral.

📍 Host Information

The resident who is hosting the visitor Please enter owner ID
Unit where visitor will be granted access Please enter unit ID

👤 Visitor Details

Full name of the visitor Please enter visitor name
Date of the visit Please select a visit date
Visitor QR Code
Will display actual QR code when generated

Visitor QR Code

This QR code provides temporary access for the visitor

📋 Visitor Information

Fill in the form above and click "Get Visitor QR" to generate a temporary QR code for the visitor.
đŸ—‘ī¸ Delete Resident: Soft delete a resident from the system. This marks them as deleted rather than removing them completely.

âš ī¸ Warning

Important: This operation will soft delete the resident from the local database and attempt to remove them from HikCentral. The resident will be marked as "deleted" but their data will remain in the system for audit purposes.

The unique identifier for the resident to delete Please enter owner ID
📚 HikCentral Middleware API Documentation

This middleware provides 5 main external APIs for resident management and access control. Use the curl examples below to communicate with the middleware.

1. 📋 GET /residents - Retrieve Resident Information

Purpose: Get resident(s) from the local database. Can retrieve all residents or a specific resident by email.

Parameters:
  • email (optional): Filter by resident email address
  • community (optional): Filter by community (when using email)
Response Format:
{"ownerId": "123", "personId": "hikcentral-456", "name": "John Doe", "email": "john@example.com", "phone": "+1234567890", "community": "GreenHills", "type": "resident", "from": "2025-01-01", "to": "2025-12-31", "unitId": "U1001", "synced": true}
Example curl Commands:
Get all residents
curl -X GET https://middleware.hpd-lc.com/residents
Get specific resident by email
curl -X GET "https://middleware.hpd-lc.com/residents?email=john@example.com"
Get resident with community filter
curl -X GET "https://middleware.hpd-lc.com/residents?email=john@example.com&community=GreenHills"

2. ➕ POST /residents - Create New Resident

Purpose: Create a new resident in both the local database and HikCentral system.

Request Body (JSON):
{"name": "John Doe", "email": "john@example.com", "phone": "+1234567890", "community": "GreenHills", "from": "2025-01-01", "to": "2025-12-31", "type": "resident", "unitId": "U1001"}
Required Fields:
  • name: Full name of the resident
  • email: Valid email address
  • community: Community identifier
  • from: Start date for access (YYYY-MM-DD)
  • to: End date for access (YYYY-MM-DD)
  • unitId: Unit identifier
Example curl Command:
Create new resident
curl -X POST https://middleware.hpd-lc.com/residents \
  -H "Content-Type: application/json" \
  -d '{"name":"John Doe","email":"john@example.com","phone":"+1234567890","community":"GreenHills","from":"2025-01-01","to":"2025-12-31","type":"resident","unitId":"U1001"}'

3. 🔑 GET /identity - Get Dynamic QR Code

Purpose: Retrieve a resident's dynamic QR code for access. Requires resident to be synced with HikCentral.

Parameters:
  • unitId (required): Unit identifier
  • ownerId (required): Resident's owner ID
Response Format:
{"id": "1", "ownerId": "123", "ownerType": "resident", "unitId": "U1001", "qrCode": "QR1234567890"}
Example curl Command:
Get resident identity and QR code
curl -X GET "https://middleware.hpd-lc.com/identity?unitId=U1001&ownerId=123"

4. 👤 GET /visitor-qr - Generate Visitor QR Code

Purpose: Create a temporary QR code for visitors. Requires resident to be synced with HikCentral.

Parameters:
  • unitId (required): Unit identifier
  • ownerId (required): Resident's owner ID (host)
  • visitorName (required): Full name of the visitor
  • visitDate (required): Date of the visit
Response Format:
{"visitId": "visit-456", "unitId": "U1001", "ownerId": "123", "ownerType": "resident", "visitorName": "Jane Smith", "visitDate": "2025-01-15", "qrCode": "VISITOR123456"}
Example curl Command:
Generate visitor QR code
curl -X GET "https://middleware.hpd-lc.com/visitor-qr?unitId=U1001&ownerId=123&visitorName=Jane%20Smith&visitDate=2025-01-15"

5. đŸ—‘ī¸ DELETE /residents - Soft Delete Resident

Purpose: Soft delete a resident from the system. Marks them as deleted rather than removing them completely.

Parameters:
  • ownerId (required): Resident's owner ID to delete
Response Format:
{"success": true}
Example curl Command:
Delete resident (soft delete)
curl -X DELETE "https://middleware.hpd-lc.com/residents?ownerId=123"

6. 📊 Additional APIs

Get API Logs
curl -X GET "https://middleware.hpd-lc.com/logs?limit=50"
Get Server Health
curl -X GET "https://middleware.hpd-lc.com/health"

7. âš ī¸ Error Handling

Common Error Responses:

400 Bad Request:
{"error": "Missing required field: name"}
404 Not Found:
{"error": "Resident not found"}
500 Internal Server Error:
{"error": "Database connection failed"}

8. 🔗 Integration Notes

  • Base URL: https://middleware.hpd-lc.com
  • Content-Type: application/json for POST requests
  • Response Format: JSON with appropriate HTTP status codes
  • Authentication: No authentication required (internal middleware)
  • Rate Limiting: None implemented (internal use)
  • Database: SQLite local database with HikCentral integration