Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Save Template Employees

บันทึกรายชื่อพนักงานใน OT Template

เป็นการแทนที่ทั้งชุด — ต้องส่งรายชื่อทั้งหมดที่ต้องการให้อยู่ใน Template คนที่ไม่อยู่ในรายการจะถูกถอดออกจาก Template

Endpoint

POST /api/v1/open-apis/calculation-ot/save-ot-round-template

สิทธิ์ที่ต้องการ: API Key ต้องมีสิทธิ์ ข้อมูลเงินเดือนทั้งองค์กร (payroll:read:all)

Request Parameters

Required Parameters

ParameterTypeRequiredDescriptionExample
master_salary_ot_report_template_idstringYesรหัส Template (Base64) — ได้จาก List OT TemplatesMjAyNTExMjdUODg5MUY2QTNEMDI0
employee_codesarrayYesรายการรหัสพนักงานทั้งหมดที่ต้องการให้อยู่ใน Template["EMP001", "EMP002"]

Request Body Example

{ "master_salary_ot_report_template_id": "MjAyNTExMjdUODg5MUY2QTNEMDI0", "employee_codes": [ "EMP001", "EMP002" ] }

Response Format

Success Response (HTTP 200)

{ "code": 200, "message": "Save OT template Accept", "payload": { "master_salary_ot_report_template_id": "20251127T8891F6A3D024", "employee_codes": [ "EMP001", "EMP002" ], "assigned_count": 2 } }

Error Response - Employee Not Found (HTTP 400)

{ "code": 400, "message": "Employee not found with code: EMP001", "payload": [] }

วิธีแก้: ตรวจสอบรหัสพนักงานให้ตรงกับที่แสดงในระบบ

Error Response - Template ID Missing (HTTP 400)

{ "code": 400, "message": "ไม่สำเร็จ", "errors": [ "กรุณาระบุ 'master_salary_ot_report_template_id'" ] }

วิธีแก้: เรียก List OT Templates เพื่อดูรหัส Template ที่มีอยู่

Error Response - Multiple Employees Not Found (HTTP 400)

{ "code": 400, "message": "ไม่พบพนักงานรหัส: EMP099, EMP100", "payload": [] }

วิธีแก้: ตรวจสอบรหัสที่ระบุ แล้วส่งใหม่ทั้งชุด — ระบบไม่บันทึกบางส่วน

Error Response - Template Not Found (HTTP 400)

{ "code": 400, "message": "ไม่พบ OT Template ตามรหัสที่ระบุ", "payload": [] }

วิธีแก้: ตรวจรหัส Template จาก List OT Templates และตรวจว่าเข้ารหัส Base64 แล้ว — รหัสที่ถอดไม่ออกจะได้ข้อความเดียวกันนี้

Error Response - Unauthorized (HTTP 401)

{ "code": 401, "message": "Unauthorized", "payload": [] }

วิธีแก้: ตรวจสอบว่า API Key ถูกต้องและมีสิทธิ์ตามที่ระบุไว้ด้านบน — ดูวิธีตั้งค่าได้ที่ Get Started

Response Fields

FieldTypeDescription
master_salary_ot_report_template_idstringรหัส Template ที่บันทึก
employee_codesarrayรายชื่อที่ส่งเข้ามา
assigned_countintจำนวนรายชื่อที่บันทึก

Code Examples

curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/calculation-ot/save-ot-round-template" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "master_salary_ot_report_template_id": "MjAyNTExMjdUODg5MUY2QTNEMDI0", "employee_codes": [ "EMP001", "EMP002" ] }'

Validation Rules

ParameterValidationError Message
master_salary_ot_report_template_idต้องระบุและเป็นรหัส Template ที่มีอยู่จริงกรุณาระบุ 'master_salary_ot_report_template_id'
employee_codesต้องเป็น array ของรหัสพนักงานกรุณาระบุ 'employee_codes' (array ของรหัสพนักงาน)
employee_codes[]ทุกรหัสต้องมีอยู่จริงในระบบไม่พบพนักงานรหัส: EMP099, EMP100

Notes

  • การแก้รายชื่อใน Template ไม่กระทบงวดที่สร้างไปแล้วจาก Template นี้
  • ดูว่ามีใครเลือกได้บ้างจาก List Available for Template
Last updated on