Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Export Salary Certificate PDF

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

ใช้ API นี้เพื่อสร้างไฟล์ PDF ของหนังสือรับรองเงินเดือน รองรับทั้ง Web และ Mobile

Endpoint

GET /api/v1/open-apis/salary-certificate/export POST /api/v1/open-apis/salary-certificate/export

Request Body

Required Parameters

ParameterTypeRequiredDescriptionExample
salary_certificate_letter_idstring (base64)Yesรหัสเอกสาร (Base64 encoded) รองรับ salary_certificate_id ด้วย"MjAyNjAzMDU0NjI1RUY2NUVGQ0E="

Optional Parameters

ParameterTypeRequiredDescriptionExample
outputstringNoโหมด output: "I" (Inline/เปิดในเบราว์เซอร์), "F" (File/ดาวน์โหลด) ค่าเริ่มต้น "F""I"
is_mobilestringNoระบุ platform: "true" สำหรับ Mobile ค่าเริ่มต้น "false""true"

Response Format

Success Response - File Mode (HTTP 200)

{ "payload": "https://example.com/exporting/abc123def456.pdf" }

Success Response - Mobile Mode (HTTP 200)

{ "message": "Success", "payload": { "salary_certificate_letter_id": "20260305IMP00000001", "employee_id": "20260309462FEF65EFCA", "salary_amt": "35000.00", "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)

{ "message": "Validation failed: salary_certificate_id or salary_certificate_letter_id is required", "payload": null }

Error Response - Certificate Not Found (HTTP 500)

{ "message": "Error: Salary certificate not found", "payload": null }

Response Fields

File Mode (output=F)

FieldTypeDescription
payloadstringURL ของไฟล์ PDF

Mobile Mode (is_mobile=true)

FieldTypeDescription
salary_certificate_letter_idstringรหัสเอกสาร (20 ตัวอักษร, plain text)
employee_idstringรหัสพนักงาน
salary_amtstringเงินเดือน
document_flow_lvstringสถานะเอกสาร
file_pdfstringURL ของไฟล์ PDF

Code Examples

# File mode (ดาวน์โหลด) curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/salary-certificate/export?salary_certificate_letter_id=MjAyNjAzMDU0NjI1RUY2NUVGQ0E=&output=F" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" # Inline mode (แสดงในเบราว์เซอร์) curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/salary-certificate/export?salary_certificate_letter_id=MjAyNjAzMDU0NjI1RUY2NUVGQ0E=&output=I" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" # Mobile mode curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/salary-certificate/export?salary_certificate_letter_id=MjAyNjAzMDU0NjI1RUY2NUVGQ0E=&is_mobile=true" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"

Notes

ข้อควรทราบ:

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