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
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
master_salary_ot_report_template_id | string | Yes | รหัส Template (Base64) — ได้จาก List OT Templates | MjAyNTExMjdUODg5MUY2QTNEMDI0 |
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
| Field | Type | Description |
|---|---|---|
master_salary_ot_report_template_id | string | รหัส Template (ต้องแปลงเป็น Base64 ก่อนส่งกลับเข้า request) |
master_salary_ot_template_code | string | รหัสอ้างอิงที่ระบบสร้างให้ |
master_salary_ot_template_name | string | ชื่อ Template |
ot_template_start_dt | string | วันที่ของเดือนที่เริ่มรอบ เช่น 21 |
ot_template_end_dt | string | วันที่ของเดือนที่จบรอบ เช่น 20 หรือ EOM = สิ้นเดือน |
ot_template_start_month | int | จำนวนเดือนที่เลื่อนจากงวดเงินเดือน เช่น -1 = เริ่มเดือนก่อนหน้า |
Code Examples
cURL
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
| Parameter | Validation | Error 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 ก.ย.
Related APIs
- List OT Templates - ดูรายการ Template ทั้งหมด
- Create Round from Template - ใช้ Template นี้สร้างงวดจริง
- Save Template Employees - แก้รายชื่อพนักงานใน Template
Last updated on