Skip to content

08.02 Get Order Rejection API


📌 At a Glance

รายการรายละเอียด
TopicGet Order Rejection API
EndpointGET /order-rejections
MethodGET
AuthenticationAPI Key
Difficulty⭐⭐ Intermediate
Reading Time10 นาที
TargetDeveloper, System Integrator

🎯 Learning Objectives

หลังจากศึกษาหัวข้อนี้แล้ว ผู้อ่านจะสามารถ

  • เรียกดูรายการที่ถูกปฏิเสธผ่าน API ได้
  • ค้นหารายการปฏิเสธตาม client_reference_no
  • กรองข้อมูลตามช่วงวันที่ได้
  • เข้าใจโครงสร้าง Response ของ Order Rejection API

Overview

Order Rejection API ใช้สำหรับดึงข้อมูลรายการ Order Checking ที่ถูกปฏิเสธโดยพนักงาน SISAHYGO

API นี้ช่วยให้ Client System สามารถตรวจสอบเหตุผลการปฏิเสธรายการ เพื่อนำข้อมูลกลับไปแก้ไขในระบบต้นทาง และส่งรายการใหม่เข้าสู่ SISAHYGO ได้อย่างถูกต้อง

ข้อมูลที่แสดงจะถูกจำกัดตาม API Client และ Customer ที่ผูกกับ API Key นั้น


Figure 8-2 Get Order Rejection API

Figure 8-2

Figure 8-2 แสดงการเรียก Order Rejection API เพื่อดึงรายการที่ถูกปฏิเสธ พร้อมเหตุผล วันที่ปฏิเสธ และข้อมูลอ้างอิงที่ Client System ใช้ในการแก้ไขข้อมูล


Endpoint

List Order Rejections

http
GET /order-rejections

Full URL

text
https://app.sisahygo.online/api/v1/order-rejections

Get Order Rejection by Client Reference No

http
GET /order-rejections/{client_reference_no}

ตัวอย่าง

http
GET /order-rejections/ERP-20260701-120750

Authentication

http
X-API-Key: {your_api_key}
Accept: application/json

Query Parameters

ParameterTypeRequiredDescription
client_reference_noStringNoค้นหาจากเลขอ้างอิงของ Client System
from_dateDateNoวันที่เริ่มต้นของ rejected_at
to_dateDateNoวันที่สิ้นสุดของ rejected_at
per_pageIntegerNoจำนวนรายการต่อหน้า ค่าเริ่มต้น 50

Sample Requests

Get Recent Rejections

http
GET /order-rejections

Filter by Client Reference No

http
GET /order-rejections?client_reference_no=ERP-20260701-120750

Filter by Date

http
GET /order-rejections?from_date=2026-07-01&to_date=2026-07-31

Get Single Rejection

http
GET /order-rejections/ERP-20260701-120750

Sample Response : List

json
{
  "data": [
    {
      "id": 101,
      "client_reference_no": "ERP-20260701-120750",
      "reason": "ข้อมูลผู้รับสินค้าไม่ถูกต้อง",
      "rejected_at": "2026-07-01T14:30:00+07:00",
      "order_header_id": 681126
    }
  ],
  "meta": {
    "current_page": 1,
    "per_page": 50,
    "total": 1,
    "last_page": 1
  }
}

Sample Response : Single Rejection

json
{
  "data": {
    "id": 101,
    "client_reference_no": "ERP-20260701-120750",
    "reason": "ข้อมูลผู้รับสินค้าไม่ถูกต้อง",
    "rejected_at": "2026-07-01T14:30:00+07:00",
    "order_header_id": 681126
  }
}

Response Data Model

FieldTypeDescription
idIntegerรหัสรายการปฏิเสธ
client_reference_noStringเลขอ้างอิงจาก Client System
reasonStringเหตุผลที่รายการถูกปฏิเสธ
rejected_atDateTimeวันที่และเวลาที่ปฏิเสธรายการ
order_header_idIntegerรหัสรายการ Order ที่เกี่ยวข้อง

Meta Object

การเรียก API แบบรายการจะมีข้อมูล Pagination

FieldDescription
current_pageหน้าปัจจุบัน
per_pageจำนวนรายการต่อหน้า
totalจำนวนรายการทั้งหมด
last_pageจำนวนหน้าทั้งหมด

Business Rules

  • แสดงเฉพาะรายการของ API Client ปัจจุบัน
  • แสดงเฉพาะรายการของ Customer ที่ผูกกับ API Key
  • หากเรียกแบบรายการ ระบบเรียงข้อมูลตาม rejected_at จากใหม่ไปเก่า
  • หากเรียกแบบรายรายการด้วย client_reference_no ระบบคืนรายการล่าสุดของเลขอ้างอิงนั้น
  • reason คือข้อความเหตุผลที่บันทึกจากฝั่ง SISAHYGO

Implementation Notes

  • ใช้ client_reference_no เชื่อมโยงกลับไปยังเอกสารใน Client System
  • ใช้ reason เพื่อแสดงให้ผู้ใช้งานทราบว่าต้องแก้ไขข้อมูลอะไร
  • ใช้ rejected_at สำหรับเรียงลำดับและแสดง Timeline
  • ใช้ order_header_id เป็นข้อมูลอ้างอิงฝั่ง SISAHYGO

Best Practices

  • ตรวจสอบ Order Rejection เป็นประจำ
  • ใช้ Filter วันที่เพื่อลดปริมาณข้อมูล
  • แสดงเหตุผลการปฏิเสธให้ผู้ใช้งานเข้าใจง่าย
  • เก็บประวัติการปฏิเสธไว้ใน Client System
  • แก้ไขข้อมูลต้นทางก่อนส่งรายการใหม่

Related APIs

  • POST /order-checkings
  • GET /shipments

Summary

Order Rejection API ช่วยให้ Client System ตรวจสอบรายการที่ไม่ผ่านการตรวจสอบจาก SISAHYGO ได้อย่างเป็นระบบ โดยใช้ client_reference_no เป็นข้อมูลเชื่อมโยงกลับไปยังเอกสารต้นทาง และใช้ reason เพื่อแก้ไขข้อมูลก่อนส่งรายการใหม่


Next Step

➡️ 08.03 Rejection Response Data Model

SISAHYGO API Integration Guide