Medical Device Remote Service Management Platform ยท API Documentation
Register a new user. Returns a JWT Token on success.
{
"username": "engineer01",
"password": "pass123",
"role": "engineer",
"name": "Engineer Zhang"
}
role: admin | manufacturer | engineer | hospital
Response 201:
{
"access_token": "eyJhbG...",
"user": {
"id": "uuid",
"username": "engineer01",
"role": "engineer",
"name": "Engineer Zhang"
}
}
User login. Returns a JWT Token. Token is valid for 7 days.
{
"username": "admin",
"password": "admin123"
}
Response 200 / 401
Get the current logged-in user's information.
Headers: Authorization: Bearer <token>
{
"id": "uuid",
"username": "admin",
"role": "admin",
"name": "Andrew",
"email": null,
"phone": null,
"company": null,
"active": true,
"createdAt": "2026-08-06T..."
}
Get a list of all users.
Get details of a single user.
Create a new user. Note: The password is not bcrypt-hashed (calls UsersService directly). It is recommended to create users via /api/auth/register instead.
Update user information.
Delete a user.
Get a list of all devices.
Register a new device.
{
"name": "Non-contact Tonometer",
"model": "TX-20",
"category": "Ophthalmology - Tonometer",
"manufacturerId": "uuid",
"serialNumber": "SN-2026-001",
"status": "active"
}
Get a list of orders. Optional ?status=xxx filter.
{
"title": "Tonometer Calibration Fault",
"description": "Device displays E02 error code...",
"deviceCategory": "Ophthalmology - Tonometer",
"deviceModel": "TX-20",
"manufacturerId": "uuid",
"engineerId": "uuid",
"priority": "medium",
"status": "pending"
}
status: pending โ accepted โ in_progress โ completed | cancelled
priority: low | medium | high | urgent
{
"orderId": "uuid",
"manufacturerUserId": "uuid",
"engineerUserId": "uuid",
"trtcRoomId": "room-123",
"notes": "Tonometer mainboard troubleshooting"
}
Generate a TRTC UserSig for the client to enter an audio/video room.
{
"userId": "engineer-01"
}
{
"sdkAppId": 1600155894,
"userId": "engineer-01",
"userSig": "eJwt..."
}
SDKAppID: 1600155894. UserSig is valid for 7 days by default.
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| username | string | Unique, login name |
| password | string | bcrypt hash, not returned by API |
| role | enum | admin/manufacturer/engineer/hospital |
| name | string? | Real name |
| company | string? | Company / hospital name |
| phone | string? | Phone number |
| string? | Email address | |
| active | boolean | Whether the account is enabled |
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| name | string | Device name |
| model | string | Device model |
| category | string | Device category (e.g. "Ophthalmology - Tonometer") |
| manufacturerId | string | Manufacturer user ID |
| hospitalId | string? | Hospital user ID |
| serialNumber | string? | Device serial number |
| installDate | Date? | Installation date |
| warrantyExpiry | Date? | Warranty expiry date |
| status | string | active/inactive |
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| title | string | Order title |
| description | text? | Problem description |
| deviceCategory | string | Device category |
| deviceModel | string? | Device model |
| manufacturerId | string | Manufacturer ID |
| engineerId | string? | Assigned engineer ID |
| hospitalId | string? | Hospital ID |
| status | enum | pending/accepted/in_progress/completed/cancelled |
| priority | string? | low/medium/high/urgent |
| scheduledAt | Date? | Scheduled service time |
| completedAt | Date? | Completion time |
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| orderId | string | Associated order ID |
| manufacturerUserId | string | Manufacturer user ID |
| engineerUserId | string | Engineer user ID |
| trtcRoomId | string? | TRTC room ID |
| recording | boolean | Whether recording is enabled |
| notes | text? | Session notes |
| startedAt | Date? | Start time |
| endedAt | Date? | End time |
| durationSeconds | number | Call duration (seconds) |
401 Unauthorized.401. The frontend automatically redirects to the login page.400 Bad Request. The body contains { "message": "..." }.
| Item | Value |
|---|---|
| Server | Alibaba Cloud ECS 47.253.228.219 |
| Web Server | Nginx 1.24.0 |
| Backend | NestJS + TypeORM + sql.js (SQLite) |
| Process Manager | PM2 (medservlink-backend) |
| HTTPS | Let's Encrypt (www.medservlink.cn) |
| TRTC SDKAppID | 1600155894 |
| Source Location | /opt/medservlink/backend/ |
| Build Command | cd /opt/medservlink/backend && npm run build && pm2 restart medservlink-backend --update-env |
| Log Location | ~/.pm2/logs/medservlink-backend-*.log |
| Database | /opt/medservlink/data/medservlink.db |