Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Update Salary Auto Checked

บันทึก/แก้ไขรายการรายรับ/รายจ่ายอัตโนมัติของพนักงาน (Batch Update) โดยจะลบรายการเดิมทั้งหมดแล้วสร้างใหม่ตามที่ส่งมา

Endpoint

POST /api/v1/open-apis/employee/update-employee-financial?path_action=salary-auto-checked

API นี้จะลบรายการอัตโนมัติเดิมทั้งหมดของพนักงาน แล้วสร้างใหม่ตาม salaryTypeLists ที่ส่งมา (Replace All)

Request Body

ParameterTypeRequiredDescription
employee_codestringYesรหัสพนักงาน
employeeListsarrayYesรายการพนักงานและรายการอัตโนมัติ
employeeLists[].employee_idstringYesID พนักงาน (Base64 encoded)
employeeLists[].salaryTypeListsarrayYesรายการ salary_type ที่ต้องการเปิด
employeeLists[].salaryTypeLists[].idstringYesID salary_type (Base64 encoded)

Validation Rules

RuleDescription
employee_codeต้องมีอยู่ในระบบ
employeeListsต้องเป็น array ที่ไม่ว่าง
employeeLists[].employee_idต้องเป็น Base64 encoded
salaryTypeLists[].idต้องเป็น Base64 encoded

Response Format

Success Response

{ "code": 200, "message": "Update Auto Checked Success", "payload": { "employee_id": "20260215EM01A2B3C4D5", "employee_code": "EMP001", "saved_items_count": 3, "saved_items": [ "20260215ST01A2B3C4D5", "20260215ST02E3F4A5B6", "20260215ST03F4G5B6C7" ] } }

Response Fields

FieldTypeDescription
employee_idstringID พนักงาน (plain text)
employee_codestringรหัสพนักงาน
saved_items_countnumberจำนวนรายการที่บันทึก
saved_itemsarrayรายการ salary_type_id ที่บันทึก (plain text)

Error Response

{ "code": 400, "message": "Validation failed", "errors": [ "Missing or invalid parameter: 'employeeLists' (must be non-empty array)" ] }
HTTP StatusDescription
400พารามิเตอร์ไม่ถูกต้อง
401API Key ไม่ถูกต้องหรือไม่ได้ส่ง

Code Examples

curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/employee/update-employee-financial?path_action=salary-auto-checked" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "employee_code": "EMP001", "employeeLists": [ { "employee_id": "MjAyNjAyMTVFTTAxQTJCM0M0RDU=", "salaryTypeLists": [ { "id": "MjAyNjAyMTVTVDAxQTJCM0M0RDU=" }, { "id": "MjAyNjAyMTVTVDAyRTNGNEE1QjY=" }, { "id": "MjAyNjAyMTVTVDAzRjRHNUI2Qzc=" } ] } ] }'

Notes

ประเภทรายรับ/รายจ่ายอัตโนมัติที่ใช้บ่อย เช่น ประกันสังคม (SSO), ภาษี (Tax), ภาษีหัก ณ ที่จ่าย (Withholding Tax) สามารถดู salary_type_id ได้จาก List Salary Auto Checked API


Last updated on