Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Save Employee Salary Auto Checked

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

การบันทึกจะลบรายการเดิมทั้งหมดของพนักงานและเพิ่มเฉพาะรายการที่ส่งมาใหม่ ตรวจสอบให้แน่ใจว่าส่งรายการที่ต้องการทั้งหมด

Endpoint

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

Query Parameters

ParameterTypeRequiredDescription
path_actionstringYesต้องเป็น save-salary-auto-checked

Request Body

ParameterTypeRequiredDescription
employee_codestringYesรหัสพนักงาน (plain text)
salary_type_listsarrayYesรายการประเภทเงินเดือนอัตโนมัติ
salary_type_lists[].salary_type_idstringYesID ของประเภทเงินเดือน (Base64 encoded)

Response Format

Success Response

{ "code": 200, "message": "Update Auto Checked Success", "payload": { "employee_id": "20260121EM01A2B3C4D5", "employee_code": "EMP001", "saved_items_count": 2, "saved_items": [ { "employee_auto_checked_id": "20260121AC01A2B3C4D5", "salary_type_id": "20260121ST01A2B3C4D5" }, { "employee_auto_checked_id": "20260121AC02E3F4A5B6", "salary_type_id": "20260121ST02E3F4A5B6" } ] } }

Response Fields

FieldTypeDescription
employee_idstringID ของพนักงาน (plain text)
employee_codestringรหัสพนักงาน
saved_items_countnumberจำนวนรายการที่บันทึก
saved_itemsarrayรายการที่บันทึกทั้งหมด
saved_items[].employee_auto_checked_idstringID รายการอัตโนมัติ (plain text)
saved_items[].salary_type_idstringID ประเภทรายรับ/รายจ่าย (plain text)

Error Response

{ "code": 400, "message": "Validation failed", "errors": [ "Missing required parameter: 'employee_code'" ] }

Validation Rules

FieldRule
employee_codeต้องระบุและต้องมีพนักงานในระบบ
salary_type_listsต้องระบุเป็น array ที่มี salary_type_id
salary_type_lists[].salary_type_idต้อง encode เป็น Base64 และต้องมีในระบบ

Code Examples

curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/employee/update-employee-financial?path_action=save-salary-auto-checked" \ -H "Content-Type: application/json" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ -d '{ "employee_code": "EMP001", "salary_type_lists": [ {"salary_type_id": "MjAyNjAxMjFTVDAxQTJCM0M0RDU="}, {"salary_type_id": "MjAyNjAxMjFTVDAyRTNGNEE1QjY="} ] }'

Notes

  • Endpoint นี้ทำงานแบบ Batch: ลบรายการเดิมทั้งหมดของพนักงาน แล้วเพิ่มเฉพาะรายการที่ส่งมาใหม่
  • หากต้องการเพิ่มทีละรายการโดยไม่กระทบรายการเดิม ให้ใช้ Add Salary Auto Checked แทน
  • salary_type_id ใน salary_type_lists ต้อง encode เป็น Base64
  • ฟิลด์ _id ใน response เป็น plain text ไม่ได้ encode Base64
  • การเปลี่ยนแปลงจะมีผลในการคำนวณเงินเดือนงวดถัดไป

Last updated on