Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Get OT Template

ดูรายละเอียดของ OT Template ตัวใดตัวหนึ่ง

ใช้ตรวจว่ารูปแบบงวดที่ตั้งไว้ใน Template จะให้ช่วงวันที่แบบใดเมื่อนำไปสร้างงวดจริง

Endpoint

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

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

Request Parameters

Required Parameters

ParameterTypeRequiredDescriptionExample
master_salary_ot_report_template_idstringYesรหัส Template (Base64) — ได้จาก List OT TemplatesMjAyNTExMjdUODg5MUY2QTNEMDI0

Request Body Example

{ "master_salary_ot_report_template_id": "MjAyNTExMjdUODg5MUY2QTNEMDI0" }

Response Format

Success Response (HTTP 200)

{ "code": 200, "message": "Get OT template Accept", "payload": { "master_salary_ot_report_template_id": "20251127T8891F6A3D024", "master_salary_ot_template_code": "OT-T001", "master_salary_ot_template_name": "งวดโอที 21-20", "ot_template_start_dt": "21", "ot_template_end_dt": "20", "ot_template_start_month": -1 } }

Error Response - Template ID Missing (HTTP 400)

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

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

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 (ต้องแปลงเป็น Base64 ก่อนส่งกลับเข้า request)
master_salary_ot_template_codestringรหัสอ้างอิงที่ระบบสร้างให้
master_salary_ot_template_namestringชื่อ Template
ot_template_start_dtstringวันที่ของเดือนที่เริ่มรอบ เช่น 21
ot_template_end_dtstringวันที่ของเดือนที่จบรอบ เช่น 20 หรือ EOM = สิ้นเดือน
ot_template_start_monthintจำนวนเดือนที่เลื่อนจากงวดเงินเดือน เช่น -1 = เริ่มเดือนก่อนหน้า

Code Examples

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

Validation Rules

ParameterValidationError Message
master_salary_ot_report_template_idต้องระบุและเป็นรหัส Template ที่มีอยู่จริงกรุณาระบุ 'master_salary_ot_report_template_id'

Notes

  • ot_template_start_month เป็นตัวเลขเลื่อนเดือน — Template ที่เริ่มวันที่ 21 และเลื่อน -1 เมื่อสร้างงวดของ 2026-09 จะได้รอบ 21 ส.ค. – 20 ก.ย.
Last updated on