Appearance
05.04 Receivers API
📌 At a Glance
| รายการ | รายละเอียด |
|---|---|
| Topic | Receivers API |
| Endpoint | GET /receivers |
| Method | GET |
| Authentication | API Key |
| Difficulty | ⭐ Beginner |
| Reading Time | 10 นาที |
| Target | Developer |
🎯 Learning Objectives
หลังจากศึกษาหัวข้อนี้แล้ว ผู้อ่านจะสามารถ
- ดึงข้อมูลผู้รับสินค้า (Receivers) จาก SISAHYGO API
- ค้นหาผู้รับสินค้าตามชื่อหรือหมายเลขโทรศัพท์
- Synchronize ข้อมูลผู้รับเข้าสู่ Client System
- ใช้ Receiver Master ในการสร้าง Order Checking
Overview
Receivers API ใช้สำหรับดึงข้อมูลผู้รับสินค้าที่ลูกค้ารายนั้นเคยจัดส่งผ่านระบบ SISAHYGO
ข้อมูลนี้ช่วยให้ Client System สามารถเลือกผู้รับเดิมได้อย่างรวดเร็ว ลดการพิมพ์ข้อมูลซ้ำ และลดข้อผิดพลาดในการสร้างรายการส่งสินค้า
Receivers API เป็น Customer Master Data ซึ่งข้อมูลของแต่ละลูกค้าจะแยกจากกันอย่างชัดเจน
Figure 5-4 Receivers API Workflow

Figure 5-4 แสดงขั้นตอนการดึงข้อมูลผู้รับสินค้าของลูกค้าผ่าน SISAHYGO API ตั้งแต่การตรวจสอบ API Key การค้นหาผู้รับ และการส่งข้อมูลกลับในรูปแบบ JSON
Business Purpose
Receivers API มีวัตถุประสงค์เพื่อ
- Synchronize รายชื่อผู้รับสินค้า
- ลดการป้อนข้อมูลซ้ำ
- ใช้ข้อมูลผู้รับชุดเดียวกันระหว่างระบบ
- เพิ่มความรวดเร็วในการสร้าง Order Checking
Endpoint
http
GET /receiversBase URL
text
https://app.sisahygo.online/api/v1/receiversAuthentication
Header
http
X-API-Key: {your_api_key}
Accept: application/jsonQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| search | string | No | ค้นหาจากชื่อผู้รับหรือหมายเลขโทรศัพท์ |
Sample Request
http
GET /receiversค้นหาจากชื่อ
http
GET /receivers?search=บริษัทค้นหาจากเบอร์โทรศัพท์
http
GET /receivers?search=081Sample Response
json
{
"data": [
{
"customer_rec_id": 1205,
"to_customer_name": "บริษัท ABC จำกัด",
"to_customer_phone": "0812345678",
"branch_rec_id": 3
},
{
"customer_rec_id": 1538,
"to_customer_name": "บริษัท XYZ จำกัด",
"to_customer_phone": "0898765432",
"branch_rec_id": 5
}
]
}Response Fields
| Field | Type | Description |
|---|---|---|
| customer_rec_id | Integer | รหัสผู้รับสินค้า |
| to_customer_name | String | ชื่อผู้รับสินค้า |
| to_customer_phone | String | หมายเลขโทรศัพท์ |
| branch_rec_id | Integer | รหัสสาขาปลายทาง |
Business Rules
- แสดงเฉพาะผู้รับของลูกค้าปัจจุบัน
- ไม่แสดงข้อมูลจาก Order ที่ถูกยกเลิก
- Group ตาม
customer_rec_id - เรียงลำดับตามชื่อผู้รับ
- ส่งกลับข้อมูลสูงสุด 100 รายการ
Validation Rules
| Rule | Description |
|---|---|
| search | ค้นหาจากชื่อหรือเบอร์โทรศัพท์ |
| API Key | ต้องถูกต้องและเปิดใช้งาน |
Error Response
| HTTP Status | Description |
|---|---|
| 401 | Invalid API Key |
| 403 | Permission Denied |
| 500 | Internal Server Error |
Implementation Notes
- Synchronize Receiver Master ก่อนสร้าง Order ใหม่
- ใช้
customer_rec_idเป็นข้อมูลอ้างอิงหลัก - หากไม่พบผู้รับ สามารถให้ผู้ใช้สร้างผู้รับใหม่ใน Client System แล้วส่งข้อมูลผ่าน Order Checking ได้
- อัปเดตข้อมูลผู้รับเป็นประจำเพื่อให้ข้อมูลล่าสุดพร้อมใช้งาน
Best Practices
- Synchronize Receiver Master ทุกวัน
- ใช้
searchเพื่อลดปริมาณข้อมูลที่ส่งกลับ - เก็บข้อมูลไว้ใน Local Database
- ใช้
customer_rec_idเป็น Primary Reference
Related APIs
- GET /products
- GET /units
- POST /order-checkings
Summary
Receivers API ช่วยให้ Client System ใช้ข้อมูลผู้รับสินค้าชุดเดียวกับ SISAHYGO ลดการป้อนข้อมูลซ้ำ เพิ่มความถูกต้องของข้อมูล และช่วยให้การสร้าง Order Checking มีประสิทธิภาพมากยิ่งขึ้น
Next Step
➡️ 05.05 Synchronization Strategy
