Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Update Employee Setting

Router สำหรับแก้ไขข้อมูลการตั้งค่าพนักงาน รองรับการเรียกใช้งานแบบแยกเรื่องผ่าน path_action parameter

API นี้ใช้ Router Pattern - ระบุ path_action เพื่อเลือกประเภทการตั้งค่าที่ต้องการแก้ไข

Endpoint

POST /api/v1/open-apis/employee/update-employee-setting

Query Parameters

ParameterTypeRequiredDescription
path_actionstringYesประเภทข้อมูลที่ต้องการแก้ไข
employee_codestringYesรหัสพนักงาน

ใช้ employee_code เพื่อระบุพนักงาน

พารามิเตอร์ที่ลงท้ายด้วย _id ต้องส่งเป็น Base64-encoded ของ raw internal ID

  • Response จะ return raw string ID (เช่น 20260121FC89F3BB9120)
  • เมื่อนำ ID จาก response ไปใช้ใน request ถัดไป ต้อง encode เป็น Base64 ก่อน

Supported Actions

Basic Settings

path_actionDescription
basicบันทึกข้อมูลพื้นฐาน (วันทำงาน, ชั่วโมง, การปัดเศษ)
approverบันทึกผู้อนุมัติ (1-5 ลำดับ)
work-cycleบันทึกกะการทำงาน

User Management

path_actionDescription
user-groupsบันทึกกลุ่มผู้ใช้
reset-user-usernameรีเซ็ตชื่อผู้ใช้
reset-user-passwordรีเซ็ตรหัสผ่าน

Time & Leave

path_actionDescription
holidayบันทึกวันทำงาน-วันหยุด
otบันทึกประเภท OT (คนเดียว)
ot-multipleบันทึกประเภท OT (หลายคน)
quotaบันทึกโควตาการลา

Other Settings

path_actionDescription
worktime-configบันทึกการตั้งค่าเวลาทำงาน
time-frameบันทึกป้ายกำกับช่วงเวลา
role-dutyบันทึกหน้าที่ปฏิบัติงาน
cost-centerบันทึกศูนย์ต้นทุน

Action Details

basic - บันทึกข้อมูลพื้นฐาน

ParameterTypeRequiredDescription
days_per_monthstringNoวันทำงานต่อเดือน
hours_per_daystringNoชั่วโมงต่อวัน
round_month_configstringNoการปัดเศษรอบเดือน (Y/N)
round_worktime_configstringNoการปัดเศษเวลาทำงาน (Y/N)
holiday_apply_configstringNoอนุญาตวันหยุดนักขัตฤกษ์ (Y/N)
round_ot_configstringNoการปัดเศษ OT (Y/N)

approver - บันทึกผู้อนุมัติ

ParameterTypeRequiredDescription
auth_firststringNoผู้อนุมัติลำดับที่ 1
auth_secondstringNoผู้อนุมัติลำดับที่ 2
auth_thirdstringNoผู้อนุมัติลำดับที่ 3
auth_fourthstringNoผู้อนุมัติลำดับที่ 4
auth_fifthstringNoผู้อนุมัติลำดับที่ 5

การบันทึกผู้อนุมัติจะลบผู้อนุมัติเดิมทั้งหมดก่อนเพิ่มใหม่

work-cycle - บันทึกกะการทำงาน

ParameterTypeRequiredDescription
work_cycle_listsarrayYesรายการกะการทำงานรายวัน

user-groups - บันทึกกลุ่มผู้ใช้

ParameterTypeRequiredDescription
usergroup_idsarrayYesรายการ ID กลุ่มผู้ใช้

reset-user-username - รีเซ็ตชื่อผู้ใช้

ParameterTypeRequiredDescription
new_usernamestringYesชื่อผู้ใช้ใหม่

reset-user-password - รีเซ็ตรหัสผ่าน

ParameterTypeRequiredDescription
new_passwordstringYesรหัสผ่านใหม่

holiday - บันทึกวันทำงาน-วันหยุด

ParameterTypeRequiredDescription
holiday_listsarrayYesรายการวันหยุดรายวัน (Mon-Sun)

ot / ot-multiple - บันทึกประเภท OT

ParameterTypeRequiredDescription
ot_type_idsarrayYesรายการ ID ประเภท OT
employee_listsarrayNoรายการพนักงาน (สำหรับ ot-multiple)

quota - บันทึกโควตาการลา

ParameterTypeRequiredDescription
quota_listsarrayYesรายการโควตาการลา

worktime-config - บันทึกการตั้งค่าเวลาทำงาน

ParameterTypeRequiredDescription
worktime_configobjectYesการตั้งค่าเวลาทำงาน

time-frame - บันทึกป้ายกำกับช่วงเวลา

ParameterTypeRequiredDescription
time_frame_listsarrayYesรายการป้ายกำกับช่วงเวลา

role-duty - บันทึกหน้าที่ปฏิบัติงาน

ParameterTypeRequiredDescription
role_duty_listsarrayYesรายการหน้าที่

cost-center - บันทึกศูนย์ต้นทุน

ParameterTypeRequiredDescription
cost_center_listsarrayYesรายการศูนย์ต้นทุน

Response Format

Success Response

{ "code": 200, "message": "Save Success", "payload": { // ข้อมูลที่บันทึกสำเร็จ } }

Error Response

{ "code": 400, "message": "ข้อมูลไม่ถูกต้อง", "errors": [ "กรุณาระบุ 'path_action'", "กรุณาระบุ 'employee_code'" ] }

Code Examples

# บันทึกข้อมูลพื้นฐาน curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/employee/update-employee-setting?path_action=basic&employee_code=EMP001" \ -H "Content-Type: application/json" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ -d '{ "days_per_month": "26", "hours_per_day": "8", "round_month_config": "Y" }' # บันทึกผู้อนุมัติ curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/employee/update-employee-setting?path_action=approver&employee_code=EMP001" \ -H "Content-Type: application/json" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ -d '{ "auth_first": "MjAyNjAxMjFENEU1RjZBN0I4Qzk=", "auth_second": "MjAyNjAxMjFFNUY2QTdCOEM5RDA=" }' # รีเซ็ตรหัสผ่าน curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/employee/update-employee-setting?path_action=reset-user-password" \ -H "Content-Type: application/json" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ -d '{ "user_id": "MjAyNjAxMjFVUzAxQTJCM0M0RDU=" }'

Auto Actions

การบันทึกข้อมูลจะมีการดำเนินการอัตโนมัติ:

  • บันทึก Activity Log
  • แจ้งเตือน HR

Troubleshooting

ErrorSolution
กรุณาระบุ ‘path_action’ต้องระบุ path_action ใน query parameter
กรุณาระบุ ‘employee_code’ต้องระบุ employee_code
Employee not foundตรวจสอบว่า employee_code ถูกต้อง
ข้อมูลไม่อัพเดทตรวจสอบ format ของข้อมูลที่ส่ง

Last updated on