Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Get Employee Leave Quota

ดึงข้อมูลโควตาการลาของพนักงานในปีที่ระบุ รวมถึงโควตาวันหยุดพิเศษ

Endpoint

GET /api/v1/open-apis/employee/get-employee-data-filter?path_action=get-quota

สิทธิ์ที่ต้องการ: API Key ต้องมีสิทธิ์ ข้อมูลพนักงานพื้นฐาน (employee:read:basic)

Query Parameters

ParameterTypeRequiredDescription
path_actionstringYesต้องเป็น get-quota
employee_codestringYesรหัสพนักงาน
quota_yearstringNoปีโควตาเป็น ปี ค.ศ. (YYYY) เช่น 2026 — ถ้าไม่ส่งจะใช้ปีปัจจุบัน

quota_year ต้องเป็นปี ค.ศ. เท่านั้น หากส่งปีที่ไม่มีข้อมูลโควตา payload จะมีเฉพาะรายการวันหยุดพิเศษ


Response Format

Success Response

{ "code": 200, "message": "สำเร็จ", "payload": [ { "time_leave_flag_id": "20260101TLF00000001", "time_leave_flag": "01", "time_leave_flag_name": "ลากิจได้รับค่าจ้าง", "time_leave_flag_name_en": "Leave with paid", "time_leave_flag_unit": "Daily", "quota_year": "2026", "quota": "6", "actual": "1", "unit": "วัน", "percentage": 0.17 }, { "time_leave_flag_id": "20260101TLF00000003", "time_leave_flag": "03", "time_leave_flag_name": "ลาป่วยมีใบรับรองแพทย์", "time_leave_flag_name_en": "Medical Leave", "time_leave_flag_unit": "Daily", "quota_year": "2026", "quota": "30", "actual": "3", "unit": "วัน", "percentage": 0.1 }, { "time_leave_flag_name": "วันหยุดพิเศษ", "time_leave_flag_name_en": "Extra holiday", "actual": "0", "quota": "8", "unit": "ชั่วโมง", "holiday_key": "extra_holiday" } ] }

Response Fields

payload เป็น Array ของโควตาแต่ละประเภทการลา เรียงตามรหัสประเภทการลา

FieldTypeDescription
time_leave_flag_idstringID ของประเภทการลา
time_leave_flagstringรหัสประเภทการลา เช่น "01", "03"
time_leave_flag_namestringชื่อประเภทการลา (ไทย)
time_leave_flag_name_enstringชื่อประเภทการลา (อังกฤษ)
time_leave_flag_unitstringหน่วยของประเภทการลา: Daily (วัน) หรือ Hour (ชั่วโมง)
quota_yearstringปีโควตา (ค.ศ.)
quotastringจำนวนโควตาทั้งหมด
actualstringจำนวนที่ใช้ไปแล้ว
unitstringหน่วยของ quota และ actual: วัน หรือ ชั่วโมง
percentagenumberสัดส่วนการใช้โควตา (actual ÷ quota) ค่าระหว่าง 0 ถึง 1

รายการวันหยุดพิเศษ — รายการสุดท้ายของ payload เสมอ

FieldTypeDescription
holiday_keystring"extra_holiday" ใช้แยกรายการนี้ออกจากประเภทการลา
time_leave_flag_namestringวันหยุดพิเศษ
time_leave_flag_name_enstringExtra holiday
quotastring/nullจำนวนโควตาวันหยุดพิเศษ — เป็น null ถ้าพนักงานไม่มีโควตาในปีนั้น
actualstring/nullจำนวนที่ใช้ไปแล้ว — เป็น null ถ้าพนักงานไม่มีโควตาในปีนั้น
unitstringชั่วโมง
  • Response ไม่มีฟิลด์ยอดคงเหลือ ให้คำนวณจาก quota - actual
  • quota และ actual เป็นตัวเลขในรูปข้อความ (เช่น "6" หรือ "12.00") ต้องแปลงเป็นตัวเลขก่อนนำไปคำนวณ
  • ประเภทการลาที่สะสมโควตาข้ามปีได้ quota และ actual จะเป็นยอดรวมของทุกปีที่สะสม

Error Response

ไม่ส่ง employee_code

{ "code": 400, "message": "ไม่สำเร็จ", "errors": [ "กรุณาระบุ 'employee_code' สำหรับ action 'get-quota'" ] }

ไม่พบพนักงาน

{ "code": 400, "message": "ไม่สำเร็จ", "error": "Employee not found with code: EMP001" }
เงื่อนไขHTTPError Message
ไม่ส่ง employee_code หรือส่งค่าว่าง400กรุณาระบุ 'employee_code' สำหรับ action 'get-quota' (ใน errors)
ไม่พบพนักงานตาม employee_code400Employee not found with code: xxx (ใน error)

Code Examples

curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/employee/get-employee-data-filter?path_action=get-quota&employee_code=EMP001&quota_year=2026" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"

Last updated on