Skip to Content
🚀 Welcome to Humansoft Open API Documentation

List Templates

ดึงรายการรายงานที่ API Key เข้าถึงได้ พร้อมรายการ filter ของแต่ละรายงาน

ใช้ API นี้เพื่อค้นหาว่ามีรายงานใดให้เลือกสร้างได้บ้าง และแต่ละรายงานรับ filter อะไร ก่อนเรียก Submit Report

Endpoint

GET /api/v1/open-apis/report-builder/reports/templates

Request Parameters

ไม่มี parameters

สิทธิ์ที่ต้องการ: API Key ต้องมีสิทธิ์ การสร้างรายงาน (report:generate) จึงจะเห็นรายงานในรายการ — หากไม่มีสิทธิ์นี้ รายการ reports จะเป็น array ว่าง (ไม่ใช่ HTTP 403)

Code Examples

curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/report-builder/reports/templates" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"

Response Format

Success Response (HTTP 200)

{ "reports": [ { "id": "net_total_month_custom", "name": { "th": "รายงานผลการคำนวณเงินเดือนสุทธิงวดปกติ Custom", "en": "Net Salary Monthly (Custom)" }, "filter_fields": [ { "key": "year_month", "type": "string", "required": true }, { "key": "department_lists", "type": "string[]" }, { "key": "keyword", "type": "string" } ] }, { "id": "payroll_period_summary", "name": { "th": "สรุปงวดเงินเดือน", "en": "Payroll Period Summary" }, "filter_fields": [ { "key": "year_month", "type": "string", "required": true }, { "key": "round_flag", "type": "string", "required": true, "allowed_values": ["Full", "Split"] }, { "key": "master_salary_split_seq", "type": "number", "allowed_values": [1, 2, 3, 4] }, { "key": "department_lists", "type": "string[]" }, { "key": "keyword", "type": "string" } ] }, { "id": "payroll_attendance_detail", "name": { "th": "รายละเอียดการลงเวลารายวัน", "en": "Payroll Attendance Detail" }, "filter_fields": [ { "key": "work_date_start", "type": "string", "required": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, { "key": "work_date_end", "type": "string", "required": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, { "key": "department_lists", "type": "string[]" }, { "key": "keyword", "type": "string" } ] }, { "id": "master_employee", "name": { "th": "ทะเบียนพนักงาน", "en": "Employee Master" }, "filter_fields": [ { "key": "year_month", "type": "string", "required": true }, { "key": "department_lists", "type": "string[]" }, { "key": "keyword", "type": "string" } ] }, { "id": "leave_transaction", "name": { "th": "รายการการลา", "en": "Leave Transactions" }, "filter_fields": [ { "key": "year", "type": "string", "required": true, "pattern": "^\\d{4}$" }, { "key": "date_from", "type": "string", "required": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, { "key": "date_to", "type": "string", "required": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, { "key": "leave_type_code", "type": "string[]" }, { "key": "keyword", "type": "string" } ] } ] }

Response Fields

FieldTypeDescription
reportsarrayรายการรายงานที่ API Key เข้าถึงได้
reports[].idstringReport ID — ใช้เป็นค่า report ตอนเรียก Submit Report
reports[].name.thstringชื่อรายงาน (ภาษาไทย)
reports[].name.enstringชื่อรายงาน (ภาษาอังกฤษ)
reports[].filter_fieldsarrayรายการ filter ที่รายงานรองรับ
reports[].filter_fields[].keystringชื่อ filter
reports[].filter_fields[].typestringประเภทข้อมูล — string, string[] หรือ number
reports[].filter_fields[].requiredbooleanมีค่า true เมื่อ filter นั้นจำเป็นต้องส่ง
reports[].filter_fields[].allowed_valuesarrayมีเมื่อ filter รับเฉพาะค่าที่กำหนด
reports[].filter_fields[].patternstringมีเมื่อค่าต้องตรงรูปแบบ regex (เช่น ^\d{4}$ สำหรับ year, ^\d{4}-\d{2}-\d{2}$ สำหรับวันที่) — ต้อง match ทั้งค่า สำหรับ string[] ทุก element ต้อง match

Error Responses

Status Codes

Codeความหมาย
200สำเร็จ (อาจคืน reports เป็น array ว่างหากไม่มีสิทธิ์)
401ไม่ได้ส่ง API Key หรือ Key ไม่ถูกต้อง
500เกิดข้อผิดพลาดระหว่างประมวลผลบนเซิร์ฟเวอร์

  • Available Columns - คอลัมน์ที่เลือกแสดงได้ของแต่ละรายงาน
  • Submit Report - ส่งคำขอสร้างรายงาน
Last updated on