Update User Groups
แก้ไขกลุ่มผู้ใช้ของพนักงาน
Endpoint
POST /api/v1/open-apis/employee/update-employee-setting?path_action=user-groupsQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path_action | string | Yes | ต้องเป็น user-groups |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
employee_code | string | Yes | รหัสพนักงาน |
user_groups | array | Yes | รายการกลุ่มผู้ใช้ที่ต้องการกำหนด |
ใช้ employee_code เพื่อระบุพนักงาน
Response Format
Success Response
{
"code": 200,
"message": "Update User Groups Success",
"payload": {
"employee_id": "20260121EM01A2B3C4D5",
"user_groups": ["admin", "hr_manager", "employee"]
}
}Error Response
{
"code": 400,
"message": "ไม่สำเร็จ",
"errors": ["กรุณาระบุ 'user_groups'"]
}Validation Rules
| Field | Rule |
|---|---|
employee_code | ต้องระบุและต้องมีพนักงานในระบบ |
user_groups | ต้องเป็น array และกลุ่มผู้ใช้ทั้งหมดต้องมีอยู่ในระบบ |
Code Examples
cURL
curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/employee/update-employee-setting?path_action=user-groups" \
-H "Content-Type: application/json" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
-d '{
"employee_code": "EMP001",
"user_groups": ["admin", "hr_manager", "employee"]
}'Notes
- การอัพเดทกลุ่มผู้ใช้จะแทนที่กลุ่มผู้ใช้เดิมทั้งหมด
- หากต้องการเพิ่มกลุ่มผู้ใช้ ให้ดึงข้อมูลกลุ่มผู้ใช้ปัจจุบันก่อน แล้วเพิ่มกลุ่มใหม่เข้าไปใน array
- กลุ่มผู้ใช้กำหนดสิทธิ์การเข้าถึงฟีเจอร์ต่างๆ ในระบบ
Related APIs
- Get User - ดึงข้อมูลบัญชีผู้ใช้
- Add User - เพิ่มบัญชีผู้ใช้
- Delete User - ลบบัญชีผู้ใช้
- Reset Password - รีเซ็ตรหัสผ่าน
- Reset Username - รีเซ็ต username
Last updated on