Skip to content

05.04 Receivers API


📌 At a Glance

รายการรายละเอียด
TopicReceivers API
EndpointGET /receivers
MethodGET
AuthenticationAPI Key
Difficulty⭐ Beginner
Reading Time10 นาที
TargetDeveloper

🎯 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

Figure 5-4 แสดงขั้นตอนการดึงข้อมูลผู้รับสินค้าของลูกค้าผ่าน SISAHYGO API ตั้งแต่การตรวจสอบ API Key การค้นหาผู้รับ และการส่งข้อมูลกลับในรูปแบบ JSON


Business Purpose

Receivers API มีวัตถุประสงค์เพื่อ

  • Synchronize รายชื่อผู้รับสินค้า
  • ลดการป้อนข้อมูลซ้ำ
  • ใช้ข้อมูลผู้รับชุดเดียวกันระหว่างระบบ
  • เพิ่มความรวดเร็วในการสร้าง Order Checking

Endpoint

http
GET /receivers

Base URL

text
https://app.sisahygo.online/api/v1/receivers

Authentication

Header

http
X-API-Key: {your_api_key}

Accept: application/json

Query Parameters

ParameterTypeRequiredDescription
searchstringNoค้นหาจากชื่อผู้รับหรือหมายเลขโทรศัพท์

Sample Request

http
GET /receivers

ค้นหาจากชื่อ

http
GET /receivers?search=บริษัท

ค้นหาจากเบอร์โทรศัพท์

http
GET /receivers?search=081

Sample 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

FieldTypeDescription
customer_rec_idIntegerรหัสผู้รับสินค้า
to_customer_nameStringชื่อผู้รับสินค้า
to_customer_phoneStringหมายเลขโทรศัพท์
branch_rec_idIntegerรหัสสาขาปลายทาง

Business Rules

  • แสดงเฉพาะผู้รับของลูกค้าปัจจุบัน
  • ไม่แสดงข้อมูลจาก Order ที่ถูกยกเลิก
  • Group ตาม customer_rec_id
  • เรียงลำดับตามชื่อผู้รับ
  • ส่งกลับข้อมูลสูงสุด 100 รายการ

Validation Rules

RuleDescription
searchค้นหาจากชื่อหรือเบอร์โทรศัพท์
API Keyต้องถูกต้องและเปิดใช้งาน

Error Response

HTTP StatusDescription
401Invalid API Key
403Permission Denied
500Internal 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

SISAHYGO API Integration Guide