Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Export Work Certificate PDF

สร้างไฟล์ PDF ของเอกสารหนังสือรับรองการทำงาน รองรับทั้งการแสดงผลแบบ Inline และการดาวน์โหลดไฟล์

รองรับ 2 โหมด: แสดงผลในเบราว์เซอร์ (output=I) และดาวน์โหลดไฟล์ (output=F) หนังสือรับรองการทำงาน ไม่มีข้อมูลเงินเดือน ใน PDF

Endpoint

GET /api/v1/open-apis/work-certificate/export

หรือ

POST /api/v1/open-apis/work-certificate/export

Request Parameters

Required Parameters

ParameterTypeRequiredDescriptionExample
work_certificate_letter_idstring (base64)Yesรหัสเอกสาร (base64 encoded)"MjAyNjAzMDVXQzAwMDAwMDAwMQ=="
authorize_idstring (base64)Yesรหัสผู้อนุมัติ (base64 encoded)"MjAyNTA0..."

Optional Parameters

ParameterTypeDefaultDescriptionExample
outputstring"I"โหมด output: "I" (Inline/เปิดในเบราว์เซอร์), "F" (File/ดาวน์โหลด)"F"
is_mobilestring"false"ระบุ platform: "true" สำหรับ Mobile"true"
document_headerstring"branch"ระบุหัวข้อเอกสาร"branch"

Response Format

Success Response - File Mode (HTTP 200)

{ "code": 200, "message": "success", "payload": "https://example.com/exporting/abc123def456.pdf" }

Success Response - Mobile Mode (HTTP 200)

{ "code": 200, "message": "Success", "payload": { "work_certificate_letter_id": "20260305WC000000001", "employee_id": "20260309462FEF65EFCA", "document_flow_lv": "02", "file_pdf": "https://example.com/exporting/abc123def456.pdf" } }

เมื่อ output=I (Inline) API จะ stream PDF โดยตรงในเบราว์เซอร์ ไม่ใช่ JSON response

Error Response - Validation Failed (HTTP 400)

{ "code": 400, "message": "Validation failed: 'work_certificate_letter_id' is required" }

Error Response - Certificate Not Found (HTTP 404)

{ "code": 404, "message": "Error: Certificate not found" }

Response Fields

File Mode (output=F)

FieldTypeNullableDescription
payloadstringNoURL ของไฟล์ PDF

Mobile Mode (is_mobile=true)

FieldTypeNullableDescription
work_certificate_letter_idstringNoรหัสเอกสาร (plain text)
employee_idstringNoรหัสพนักงาน
document_flow_lvstringNoสถานะเอกสาร
file_pdfstringNoURL ของไฟล์ PDF

Code Examples

# ดาวน์โหลดไฟล์ PDF (File Mode) curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/work-certificate/export?work_certificate_letter_id=MjAyNjAzMDVXQzAwMDAwMDAwMQ==&authorize_id=MjAyNTA0&output=F" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" # แสดง PDF ในเบราว์เซอร์ (Inline Mode) curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/work-certificate/export?work_certificate_letter_id=MjAyNjAzMDVXQzAwMDAwMDAwMQ==&authorize_id=MjAyNTA0&output=I" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" # สร้าง PDF สำหรับ Mobile curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/work-certificate/export?work_certificate_letter_id=MjAyNjAzMDVXQzAwMDAwMDAwMQ==&authorize_id=MjAyNTA0&is_mobile=true" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"

Notes

ข้อควรทราบ:

  • work_certificate_letter_id ใน request ต้องเข้ารหัส base64
  • เมื่อ output=I API จะ stream PDF โดยตรง ไม่ส่ง JSON response
  • ลายเซ็นใน PDF จะเลือกตามภาษาเอกสาร (doc_language)
  • ถ้าพนักงานลาออกแล้ว ระบบจะใช้วันที่ลาออกเป็นวันที่สิ้นสุดการทำงานใน PDF
  • Get Detail - ดูรายละเอียดเอกสารก่อน export
  • Approve - อนุมัติเอกสารก่อน export (แนะนำ)
  • Get Signatures - ดูลายเซ็นที่ใช้ได้
Last updated on