Developer Docs

เริ่มต้น

Partner API — Auth

Partner API — Products

Partner API — Inventory

Partner API — Customers

Partner API — Reports

Send Test Ping

ส่ง Test Event ประเภท ping ไปยัง endpoint_url ของ Webhook Subscription เพื่อทดสอบว่า Endpoint รับ Request ได้จริง

Response จะบอกว่า Endpoint ของคุณตอบกลับอะไร — ทำให้ Debug ได้โดยไม่ต้องรอ Event จริงเกิดขึ้น

Endpoint นี้เหมาะสำหรับ:

  • ทดสอบ Connectivity หลังสร้าง Webhook ใหม่
  • ตรวจสอบว่า Signature Verification ทำงานถูกต้อง
  • Debug เมื่อ Webhook Delivery ล้มเหลวแต่ไม่แน่ใจว่าปัญหาอยู่ที่ฝั่งไหน

Required Scope

read:webhooks

Endpoint

POST /api/partner/v1/webhooks/:id/ping

Request Headers

Authorization: Bearer <access_token>

Path Parameters

ParameterTypeRequiredDescription
idstring (UUID)YesWebhook Subscription ID

Request Body: ไม่ต้องส่ง


Example Request

curl -X POST \
  "https://<host>/api/partner/v1/webhooks/a1b2c3d4-0000-0000-0000-000000000001/ping" \
  -H "Authorization: Bearer <access_token>"

Successful Response

200 OK
{
  "data": {
    "webhook_id": "a1b2c3d4-0000-0000-0000-000000000001",
    "delivered": true,
    "response_status": 200,
    "response_body": "ok"
  }
}

Response Fields

FieldTypeDescription
webhook_idstring (UUID)Webhook Subscription ID
deliveredbooleantrue หาก Endpoint ตอบกลับ 2xx
response_statusnumber | nullHTTP Status ที่ได้รับจาก Endpoint — null หากเกิด Network Error หรือ Timeout
response_bodystring | nullส่วนแรกของ Response Body ที่ได้รับจาก Endpoint

หมายเหตุ

Ping จะส่ง Payload โครงสร้างเดียวกับ Event จริง — Endpoint ต้องผ่าน Signature Verification เช่นกัน

delivered: false ไม่ได้หมายความว่า API ล้มเหลว — API ทำงานสำเร็จ แต่ Endpoint ของคุณตอบกลับ non-2xx หรือไม่ตอบสนอง ให้ตรวจสอบ response_status และ response_body เพื่อ Debug


Error Responses

Subscription Not Active

400 Bad Request
{
  "error": "invalid_request",
  "message": "Webhook subscription is not active"
}

สาเหตุ:

  • Subscription มีสถานะเป็น PAUSED หรือ DISABLED
  • ต้องเปลี่ยนสถานะเป็น ACTIVE ก่อนจึงจะ Ping ได้

Subscription Not Found

404 Not Found
{
  "error": "not_found",
  "message": "Webhook subscription not found"
}

สาเหตุ:

  • id ไม่ถูกต้อง
  • Subscription เป็นของ Application อื่น