Get Yearly Report
ดึงรายงานโควตาการลารายปี รองรับผลลัพธ์หลายรูปแบบ: JSON (แบบแบ่งหน้า), Excel และ PDF
Endpoint
GET /api/v1/open-apis/salary/get-data-filter?path_action=get_all_year_quota_reportรองรับทั้ง GET และ POST method — สามารถส่ง filter ผ่าน Query String หรือ Request Body ได้
Request Parameters
| Parameter | Type | Required | Description | Default | Example |
|---|---|---|---|---|---|
quota_year | string | Yes | ปีโควตา (YYYY) | - | "2026" |
type | string | No | รูปแบบผลลัพธ์ (ดูตารางด้านล่าง) | "json" | "excel" |
_page | integer | No | หน้าที่ (เมื่อ type=json) | 1 | 2 |
_number_per_page | integer | No | จำนวนต่อหน้า (max 500, เมื่อ type=json) | 50 | 100 |
count_of_employee_limit | integer | No | จำกัดจำนวนพนักงานสูงสุด | 4000 | 5000 |
check_count_of_employee | boolean | No | ตรวจจำนวนพนักงานก่อน export | true | false |
filename | string | No | ชื่อไฟล์เมื่อ export | - | "quota_report_2026" |
company_id | string | No | กรองตามบริษัท (Base64) | - | - |
branch_id | string | No | กรองตามสาขา (Base64) | - | - |
department_id | string | No | กรองตามแผนก (Base64) | - | - |
position_id | string | No | กรองตามตำแหน่ง (Base64) | - | - |
employee_id | string | No | กรองเฉพาะพนักงาน (Base64) | - | - |
keyword | string | No | ค้นหาจากชื่อ-นามสกุล, รหัส | - | "EMP001" |
employee_type_code | array | No | กรองตามประเภทพนักงาน | - | ["01"] |
Output Types
| Type | Description |
|---|---|
json | ผลลัพธ์ JSON แบบแบ่งหน้า (default) |
excel | ไฟล์ Excel (.xlsx) |
excel1 | ไฟล์ Excel แบบมีคอลัมน์ Quota/Used/Remaining |
pdf | ไฟล์ PDF |
pdf1 | ไฟล์ PDF แบบมีคอลัมน์ Quota/Used/Remaining |
Response Format
Success Response (type=json)
{
"code": 200,
"message": "Success",
"payload": {
"lists": [
{
"employee_code": "EMP001",
"employee_name": "สมชาย ใจดี",
"department_name": "แผนกบัญชี",
"position_name": "พนักงานบัญชี",
"quota_year": "2026",
"leave_types": [
{
"leave_type_code": "01",
"leave_type_name": "ลาป่วย",
"quota": 30,
"used": 5,
"remaining": 25
}
]
}
],
"_TOTAL_RECORDS": 150,
"_PAGINATION": {
"current_page": 1,
"total_pages": 2,
"per_page": 100
}
}
}Response Fields (type=json)
| Field | Type | Description |
|---|---|---|
lists | array | รายการโควตาพนักงาน |
lists[].employee_code | string | รหัสพนักงาน |
lists[].employee_name | string | ชื่อ-นามสกุลพนักงาน |
lists[].department_name | string | ชื่อแผนก |
lists[].position_name | string | ชื่อตำแหน่ง |
lists[].quota_year | string | ปีโควตา |
lists[].leave_types | array | รายการประเภทการลา |
lists[].leave_types[].leave_type_code | string | รหัสประเภทการลา |
lists[].leave_types[].leave_type_name | string | ชื่อประเภทการลา |
lists[].leave_types[].quota | number | โควตาที่ได้รับ |
lists[].leave_types[].used | number | โควตาที่ใช้ไป |
lists[].leave_types[].remaining | number | โควตาคงเหลือ |
_TOTAL_RECORDS | number | จำนวนรายการทั้งหมด |
_PAGINATION | object | ข้อมูล pagination |
Success Response (type=excel, pdf)
- Content-Type:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet(Excel) หรือapplication/pdf(PDF) - Body: Binary stream ของไฟล์
Error Response
{
"code": 400,
"message": "ไม่สำเร็จ",
"errors": ["Missing required parameter: 'quota_year'"]
}Payload Too Large (413)
{
"code": 413,
"message": "Payload Too Large",
"payload": "employee-overlimit"
}ถ้าจำนวนพนักงานเกิน count_of_employee_limit ระบบจะตอบ HTTP 413 — ใช้ filter เพื่อจำกัดขอบเขตให้แคบลง
Code Examples
cURL
# ดึงรายงาน JSON แบบแบ่งหน้า
curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/salary/get-data-filter?path_action=get_all_year_quota_report"a_year=2026&_page=1&_number_per_page=100" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"
# Export เป็น Excel
curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/salary/get-data-filter?path_action=get_all_year_quota_report"a_year=2026&type=excel" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
--output quota_report_2026.xlsx
# Export เป็น PDF เฉพาะแผนก
curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/salary/get-data-filter?path_action=get_all_year_quota_report"a_year=2026&type=pdf&department_id=MjAyNTEwMDYxOTJGRTg4RTk3QTU=" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
--output quota_report_dept.pdfNotes
- เมื่อ
type=jsonระบบจะแบ่งหน้าอัตโนมัติ (default 50 รายการต่อหน้า, สูงสุด 500) - เมื่อ
type=excelหรือtype=pdfระบบจะส่ง binary stream — ใช้--outputใน cURL เพื่อบันทึกไฟล์ - ใช้
type=excel1หรือtype=pdf1เพื่อดูรายละเอียด Quota/Used/Remaining แยกคอลัมน์ - ถ้ามีพนักงานจำนวนมาก ใช้ filter เพื่อจำกัดขอบเขตการ export
Related APIs
- List Quotas - ดูรายการโควตาแบบละเอียด
- Get Quota by Employee - ดูโควตาของพนักงานคนใดคนหนึ่ง
- Calculate Quota - คำนวณโควตาการลา
Last updated on