Get Employee Data
ดึงข้อมูลพนักงานตามประเภทที่ต้องการ (Setting, Profile, Financial หรือทั้งหมด) เหมาะสำหรับกรณีที่ต้องการเฉพาะบางหมวดข้อมูล
API นี้ให้ความยืดหยุ่นในการเลือกดึงข้อมูลเฉพาะหมวดที่ต้องการ ช่วยลดขนาด response และเพิ่มประสิทธิภาพ
พารามิเตอร์ที่ลงท้ายด้วย _id ต้องส่งเป็น Base64-encoded ของ raw internal ID
- Response จะ return raw string ID (เช่น
20260121FC89F3BB9120) - เมื่อนำ ID จาก response ไปใช้ใน request ถัดไป ต้อง encode เป็น Base64 ก่อน
Endpoint
GET /api/v1/open-apis/employee/get-employee-dataQuery Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
employee_code | string | Yes | รหัสพนักงานที่ต้องการดึงข้อมูล | EMP001 |
type | string | Yes | ประเภทข้อมูลที่ต้องการ | all |
welfare_year | string | No | ปีสวัสดิการ (สำหรับ financial) | 2026 |
Type Options
| Type | Description | Returns |
|---|---|---|
all | ข้อมูลทั้งหมด | setting + profile + financial |
setting | การตั้งค่าพนักงาน | setting fields only |
profile | ข้อมูลส่วนตัว | profile fields only |
financial | ข้อมูลการเงิน | financial fields only |
Response Format
Success Response (HTTP 200)
Type = all
{
"code": 200,
"message": "สำเร็จ",
"payload": {
"setting": {
"general": {...},
"approver_lists": [...],
"user_lists": {...},
"work_cycle_lists": {...},
"holiday_lists": {...},
"ot_lists": {...},
"quota_lists": {...},
"worktime_configs": {...},
"facial": [...],
"time_frame_lists": {...},
"cost_center_lists": [...],
"role_duty_lists": {...}
},
"profile": {
"address": {...},
"family_lists": [...],
"work_lists": [...],
"education_lists": [...],
"ability_lists": [...],
"language_skill_lists": [...],
"typing_skill_lists": [...],
"driving_skill_lists": [...],
"document_lists": [...],
"trainning_lists": [...],
"possess_lists": [...],
"loan_lists": [...],
"hospital_lists": [...]
},
"financial": {
"tax_lists": [...],
"fund_lists": [...],
"work_insurance_lists": [...],
"welfare_lists": [...],
"constant_lists": [...],
"salary_auto_checked_lists": [...]
}
}
}Error Response (HTTP 400)
{
"code": 400,
"message": "ไม่สำเร็จ",
"error": "Employee profile not found for id: INVALID_ID"
}Response Fields by Type
Setting Fields
| Field | Type | Description |
|---|---|---|
general | object | ตั้งค่าทั่วไป (วันทำงาน, ชั่วโมงทำงาน) |
approver_lists | array | รายการผู้อนุมัติ |
user_lists | object | ข้อมูลบัญชีผู้ใช้งาน |
work_cycle_lists | object | กะการทำงานรายวัน (Mon-Sun) |
holiday_lists | object | วันหยุดรายวัน |
ot_lists | object | ประเภท OT ที่อนุญาต |
quota_lists | object | โควตาการลา + อายุงาน |
worktime_configs | object | การตั้งค่าเวลาทำงาน |
facial | array | ข้อมูลใบหน้า |
time_frame_lists | object | กรอบเวลา |
cost_center_lists | array | ศูนย์ต้นทุน |
role_duty_lists | object | หน้าที่ปฏิบัติงาน |
Profile Fields
| Field | Type | Description |
|---|---|---|
address | object | ที่อยู่ + ข้อมูลพื้นฐาน |
family_lists | array | ข้อมูลครอบครัว |
work_lists | array | ประวัติการทำงาน |
education_lists | array | ประวัติการศึกษา |
ability_lists | array | ความสามารถพิเศษ |
language_skill_lists | array | ทักษะภาษา |
typing_skill_lists | array | ทักษะการพิมพ์ |
driving_skill_lists | array | ทักษะการขับขี่ |
document_lists | array | เอกสาร |
trainning_lists | array | ประวัติฝึกอบรม |
possess_lists | array | ทรัพย์สิน |
loan_lists | array | เงินกู้ |
hospital_lists | array | โรงพยาบาล |
Financial Fields
| Field | Type | Description |
|---|---|---|
tax_lists | array | ข้อมูลภาษีรายปี |
fund_lists | array | กองทุนสำรองเลี้ยงชีพ |
work_insurance_lists | array | ประกันสังคม |
welfare_lists | array | สวัสดิการ |
constant_lists | array | รายรับ/รายจ่ายคงที่ |
salary_auto_checked_lists | array | รายการตรวจสอบเงินเดือน |
Code Examples
cURL
# ดึงข้อมูลทั้งหมด
curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/employee/get-employee-data?employee_code=EMP001&type=all" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"
# ดึงเฉพาะ Setting
curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/employee/get-employee-data?employee_code=EMP001&type=setting" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"
# ดึงเฉพาะ Profile
curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/employee/get-employee-data?employee_code=EMP001&type=profile" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"
# ดึงเฉพาะ Financial พร้อมระบุปีสวัสดิการ
curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/employee/get-employee-data?employee_code=EMP001&type=financial&welfare_year=2026" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"Notes
เมื่อไหร่ควรใช้ type=all:
- เมื่อต้องการดึงข้อมูลทั้งหมดในครั้งเดียว
- เมื่อต้องการแสดงหน้ารวมข้อมูลพนักงาน
- ลด API calls จาก 3 ครั้ง เหลือ 1 ครั้ง
ข้อควรระวัง:
- Response มีขนาดใหญ่กว่าปกติเมื่อใช้
type=all - ใช้เวลาประมวลผลนานกว่า type เดี่ยว
- ถ้าต้องการเฉพาะบางส่วน ใช้ type=setting, type=profile, หรือ type=financial แทน
Difference from Get Employee Info
| Feature | Get Employee Info | Get Employee Data |
|---|---|---|
| Parameter | employee_code | employee_code |
| Response | Fixed structure (18 lists) | Flexible by type |
| Use Case | แสดงข้อมูลครบถ้วน | เลือกดึงเฉพาะหมวด |
Related APIs
- Get Employee Info - ดึงข้อมูลครบถ้วนโดยใช้ employee_code
- Get Employee List - ดึงรายการพนักงานทั้งหมด
- Update Employee - แก้ไขข้อมูลพนักงาน
Last updated on