Push NotificationsNotification Endpoint
Đăng ký Endpoint
Đăng ký hoặc cập nhật endpoint nhận thông báo (upsert by owner-scope).
Endpoint
POST /v1/notificationendpoints/register
Body Parameters
| Tên | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
company_id | int | Có | ID công ty |
owner_type | int | string | Có | Loại chủ sở hữu (1/"user", 3/"customer", 5/"system") |
owner_id | int | Có | ID chủ sở hữu (User ID hoặc Customer ID) |
channel_type | int | Có | Loại kênh thông báo (VD: 9 = Push) |
endpoint_value | string | Có | Giá trị token/endpoint (VD: FCM registration token) |
app_code | string | Có | Mã ứng dụng (VD: pos, web, app) |
creator_id | int | ID người thực hiện đăng ký. Mặc định: 0 | |
provider | string | Nhà cung cấp dịch vụ push. Mặc định: fcm | |
platform | string | Nền tảng thiết bị (VD: android, ios, web) | |
device_id | string | UUID thiết bị |
Ví dụ JSON
{
"company_id": 10311,
"creator_id": 456,
"owner_type": 1,
"owner_id": 789,
"channel_type": 9,
"provider": "fcm",
"endpoint_value": "fcm_token_string...",
"app_code": "pos",
"platform": "android",
"device_id": "device-uuid-string"
}Response Schema
HTTP 200 - JSON Object
Trả về object Notification Endpoint vừa tạo/cập nhật.
Error Codes
| HTTP | Code | Mô tả |
|---|---|---|
| 422 | error_company_id_required | ID công ty không được để trống |
| 422 | error_owner_type_required | Loại chủ sở hữu không được để trống |
| 422 | error_owner_type_invalid | Loại chủ sở hữu không hợp lệ |
| 422 | error_owner_id_required | ID chủ sở hữu không được để trống hoặc phải > 0 |
| 422 | error_channel_type_required | Loại kênh không được để trống hoặc phải > 0 |
| 422 | error_endpoint_value_required | Giá trị endpoint không được để trống |
| 422 | error_app_code_required | Mã ứng dụng không được để trống |
| 500 | error_register_endpoint | Lỗi khi đăng ký endpoint |