Excel Template
สร้างไฟล์ Excel Template สำหรับนำเข้าข้อมูลสวัสดิการ พร้อม pre-fill ข้อมูลพนักงานตาม filter ที่ส่งมา Response ที่ได้จะเป็นไฟล์ Excel (ไม่ใช่ JSON)
Endpoint
POST /api/v1/open-apis/welfare/excel_templateRequest Body
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
salary_type_id | string (base64) | Yes | รหัสประเภทสวัสดิการ | "MjAyNjAzMDNTVFlQWDAwMDE=" |
welfare_year | string | Yes | ปีสวัสดิการ (YYYY) | "2026" |
Optional Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
authorize_line | string | No | "true" เพื่อ scope ตามสายบังคับบัญชา | "true" |
Request Body Example
{
"salary_type_id": "MjAyNjAzMDNTVFlQWDAwMDE=",
"welfare_year": "2026"
}Response Format
Success Response (HTTP 200)
Response เป็นไฟล์ Excel binary (ไม่ใช่ JSON)
Response Headers:
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheetContent-Disposition: attachment;filename="Import_Welfare_Data.xlsx"
โครงสร้างคอลัมน์ในไฟล์ที่ได้
| # | Column (TH) | Column (EN) |
|---|---|---|
| 1 | รหัสพนักงาน | Employee Code |
| 2 | สำนักงานสาขา | Branch |
| 3 | แผนก | Department |
| 4 | ตำแหน่ง | Position |
| 5 | ชื่อ-นามสกุล | Name |
| 6 | รหัสสวัสดิการ | Welfare Code |
| 7 | ชื่อสวัสดิการ | Welfare Name |
| 8 | ยอดยกมา | Balance |
| 9 | วงเงิน | Amount |
ค่าที่ pre-fill:
- คอลัมน์พนักงาน/องค์กร: เป็นข้อมูลอ่านอย่างเดียว
- คอลัมน์รหัส/ชื่อสวัสดิการ: ดึงจาก
salary_type_idที่ส่งมา - คอลัมน์ยอดยกมา: ใส่ยอดยกมาถ้ามีข้อมูลในระบบ
- คอลัมน์วงเงิน: ว่างไว้ให้ผู้ใช้กรอก
Error Response (HTTP 400)
{
"code": 400,
"message": "..."
}Code Examples
cURL
curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/welfare/excel_template" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"salary_type_id": "MjAyNjAzMDNTVFlQWDAwMDE=",
"welfare_year": "2026"
}' \
-o "Import_Welfare_Data.xlsx"Notes
ข้อควรทราบ:
salary_type_idใน request ต้องเข้ารหัส Base64- Response ของ endpoint นี้เป็นไฟล์ Excel ไม่มี JSON payload
- ชื่อไฟล์ที่ดาวน์โหลดจะเป็น
นำเข้าข้อมูลสวัสดิการ.xlsx(TH) หรือImport_Welfare_Data.xlsx(EN) ตามภาษาที่ตั้งค่าไว้
Related APIs
- Excel Import - อัปโหลดไฟล์เพื่อ import เข้าระบบ
- Import JSON - ส่งข้อมูลแถว JSON แทนไฟล์
- List Welfare Employee By Type - ตรวจสอบข้อมูลก่อน/หลัง import
Last updated on