Get Employee Cost Center
ดึงข้อมูลศูนย์ต้นทุนประจำสัปดาห์ของพนักงาน
Endpoint
GET /api/v1/open-apis/employee/get-employee-data-filter?path_action=get-cost-centerQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path_action | string | Yes | ต้องเป็น get-cost-center |
employee_code | string | Yes | รหัสพนักงาน |
ใช้ employee_code เพื่อระบุพนักงาน
Response Format
Success Response
{
"code": 200,
"message": "สำเร็จ",
"payload": {
"Mon": { "day": "Mon", "cost_center_id": "CC001", "cost_center_info": { "name": "สำนักงานใหญ่" } },
"Tue": { "day": "Tue", "cost_center_id": "CC001", "cost_center_info": { "name": "สำนักงานใหญ่" } },
"Wed": { "day": "Wed", "cost_center_id": "CC001", "cost_center_info": { "name": "สำนักงานใหญ่" } },
"Thu": { "day": "Thu", "cost_center_id": "CC001", "cost_center_info": { "name": "สำนักงานใหญ่" } },
"Fri": { "day": "Fri", "cost_center_id": "CC001", "cost_center_info": { "name": "สำนักงานใหญ่" } },
"Sat": { "day": "Sat", "cost_center_id": "", "cost_center_info": null },
"Sun": { "day": "Sun", "cost_center_id": "", "cost_center_info": null }
}
}Response Fields
payload เป็น Object ที่ key คือชื่อวัน (Mon-Sun) แต่ละวันมีฟิลด์:
| Field | Type | Description |
|---|---|---|
day | string | ชื่อวัน (Mon, Tue, Wed, Thu, Fri, Sat, Sun) |
cost_center_id | string | รหัสศูนย์ต้นทุน (ว่าง = ไม่กำหนด) |
cost_center_info | object/null | ข้อมูลศูนย์ต้นทุน (null = ไม่กำหนด) |
cost_center_info.name | string | ชื่อศูนย์ต้นทุน |
Error Response
{
"code": 400,
"message": "ไม่สำเร็จ",
"error": "Employee not found with code: EMP999"
}| เงื่อนไข | Error Message |
|---|---|
ไม่ส่ง employee_code หรือว่าง | Missing required parameter: employee_code |
| หา employee ไม่เจอ | Employee not found with code: xxx |
Code Examples
cURL
curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/employee/get-employee-data-filter?path_action=get-cost-center&employee_code=EMP001" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Related APIs
- Update Cost Center - บันทึกศูนย์ต้นทุนของพนักงาน
Last updated on