ดึงรายการสินค้าพร้อม SKU ทั้งหมดของธุรกิจ
Products เป็นข้อมูลระดับ Business ไม่แยกตามสาขา — ทุก Token ที่มี Scope read:products จะเห็นสินค้าทั้งหมดของธุรกิจ
Endpoint นี้เหมาะสำหรับ:
product_sku_id สำหรับ join กับข้อมูล Sales และ Inventoryread:products
Access Token ต้องได้รับ Scope read:products มิฉะนั้นระบบจะปฏิเสธคำขอ
GET /api/partner/v1/products
Authorization: Bearer <access_token>
| Parameter | Type | Required | Description |
|---|---|---|---|
| is_active | boolean | No | กรองตามสถานะสินค้า — true หรือ false |
| category_id | string (UUID) | No | กรองตาม Product Category |
| q | string | No | ค้นหาจาก product_name หรือ product_code (1–255 ตัวอักษร) |
| limit | integer | No | จำนวนรายการต่อหน้า (1–200) ค่าเริ่มต้น 50 |
| cursor | string | No | Cursor สำหรับดึงหน้าถัดไป |
Endpoint นี้ใช้ Cursor-based Pagination
หาก has_more เป็น true ให้ส่ง next_cursor กลับมาใน parameter cursor เพื่อดึงหน้าถัดไป
GET /api/partner/v1/products?cursor=<next_cursor>
ค่า Cursor เป็น Opaque Value — ไม่ควรอ่าน แก้ไข หรือสร้างเอง
curl -X GET \
"https://<host>/api/partner/v1/products?is_active=true&limit=50" \
-H "Authorization: Bearer <access_token>"
{
"data": [
{
"id": "29b44aa5-a145-422f-a1b6-7a983147c43e",
"product_code": "สเต-10734",
"product_name": "สเต๊ะรวม 100 ไม้",
"product_name_en": "",
"category_id": "3ea9302b-6470-461f-b8ab-1e0f6bc3abae",
"unit_id": "7d482fd4-f20a-452c-8177-a704cd05f9a0",
"is_active": true,
"track_inventory": false,
"image_url": "",
"created_at": "2026-05-24T09:28:07.890Z",
"updated_at": "2026-05-24T09:28:07.890Z",
"product_skus": [
{
"id": "9ed16e5b-702b-4980-b59c-996d44b732b8",
"sku_code": "SKU-001",
"sku_name": "สเต๊ะรวม 100 ไม้",
"barcode": "",
"unit_id": null,
"is_default": true,
"is_active": true
}
]
}
],
"pagination": {
"next_cursor": "...",
"has_more": true,
"limit": 50
}
}
| Field | Type | Description |
|---|---|---|
| id | string (UUID) | Product ID |
| product_code | string | รหัสสินค้า |
| product_name | string | ชื่อสินค้า (ภาษาหลัก) |
| product_name_en | string | ชื่อสินค้า (ภาษาอังกฤษ) |
| category_id | string (UUID) | null | หมวดหมู่สินค้า |
| unit_id | string (UUID) | null | หน่วยนับ |
| is_active | boolean | true หากสินค้ายังใช้งานอยู่ |
| track_inventory | boolean | true หากสินค้านี้ติดตาม Stock |
| image_url | string | URL รูปภาพสินค้า |
| created_at | string (ISO 8601) | เวลาที่สร้าง record |
| updated_at | string (ISO 8601) | เวลาที่แก้ไขล่าสุด |
| product_skus | ProductSku[] | รายการ SKU ของสินค้านี้ |
หาก track_inventory เป็น false สินค้านั้นจะไม่ปรากฏในข้อมูล Inventory — ไม่มีการนับ Stock
| Field | Type | Description |
|---|---|---|
| id | string (UUID) | SKU ID — ใช้ join กับ Sales และ Inventory |
| sku_code | string | รหัส SKU |
| sku_name | string | ชื่อ SKU |
| barcode | string | Barcode (ถ้ามี) |
| unit_id | string (UUID) | null | หน่วยนับของ SKU นี้ |
| is_default | boolean | true หากเป็น SKU หลักของสินค้า |
| is_active | boolean | true หาก SKU นี้ยังใช้งานอยู่ |