GET /api/private/v1/customers/:customerId
读取指定客户的详细信息。
路径参数
| 参数 | 说明 |
|---|---|
customerId | 客户 ID |
成功响应
返回完整客户记录,并附带 credentials 与 identifiers:
{
"ok": true,
"requestId": "req_123",
"data": {
"id": 1,
"username": "customer_001",
"projectId": "clx_project",
"enabled": true,
"temporary": false,
"createdAt": "2026-03-01T00:00:00.000Z",
"updatedAt": "2026-03-21T00:00:00.000Z",
"credentials": [
{ "id": 9, "type": 0, "createdAt": "2026-03-01T00:00:00.000Z" }
],
"identifiers": [
{
"id": 10,
"type": "username",
"value": "customer_001",
"readonly": true,
"createdAt": "2026-03-01T00:00:00.000Z",
"updatedAt": "2026-03-21T00:00:00.000Z"
},
{
"id": 11,
"type": "email",
"value": "user@example.com",
"readonly": false,
"createdAt": "2026-03-21T00:00:00.000Z",
"updatedAt": "2026-03-21T00:00:00.000Z"
}
]
}
}
PATCH /api/private/v1/customers/:customerId
更新指定客户。
请求体
{
"username": "customer_002",
"enabled": false,
"password": "new-secret",
"identifiers": [
{ "type": "email", "value": "new@example.com" },
{ "type": "external_user_id", "value": "u_2002" }
]
}
所有字段都可选:
| 字段 | 类型 | 说明 |
|---|---|---|
username | string | 新用户名,8 到 16 位 |
enabled | boolean | 是否启用 |
password | string | 新密码,更新或创建密码凭证 |
identifiers | array | 额外客户标识完整列表,不包含系统维护的 username 标识 |
更新 username 时,系统会同步更新只读的 type="username" 标识。
成功响应
返回更新后的客户对象,包含最新 identifiers。
DELETE /api/private/v1/customers/:customerId
删除指定客户。
成功响应
{
"ok": true,
"requestId": "req_123",
"data": { "success": true }
}
可能错误
404 CUSTOMER_NOT_FOUND