ข้ามไปยังเนื้อหา

การจัดการข้อผิดพลาด

ANKK Public API จะส่งคืนรหัสสถานะ HTTP มาตรฐานพร้อมกับรายละเอียดข้อผิดพลาดในรูปแบบ JSON


การตอบกลับข้อผิดพลาดทั้งหมดใช้สคีมาต่อไปนี้:

{
"error": "idempotency_conflict",
"message": "The idempotency key was already used with a different request payload.",
"param": "idempotency_key"
}

รหัสสถานะรหัสข้อผิดพลาดความหมายและการดำเนินการที่แนะนำ
400 Bad Requestinvalid_input, validation_failedรูปแบบเนื้อหาคำขอหรือพารามิเตอร์ไม่ถูกต้อง โปรดแก้ไขเพย์โหลด
401 Unauthorizedunauthorized, invalid_api_keyคีย์ API ขาดหายหรือไม่ถูกต้อง
403 Forbiddeninsufficient_scope, quota_exceededขาดขอบเขตสิทธิ์ที่จำเป็นหรือเกินโควตาของแผนบริการ
404 Not Foundnot_foundไม่พบทรัพยากร (content_id, connection_id)
409 Conflictidempotency_conflictใช้คีย์ป้องกันคำขอซ้ำเดิมกับเพย์โหลดที่ไม่ตรงกัน
423 Lockedbrand_lockedแบรนด์ถูกล็อกเนื่องจากการชำระเงินหรือนโยบาย ตรวจสอบที่ การชำระเงิน
429 Too Many Requestsrate_limitedเรียกใช้งานเกินอัตราที่กำหนด กรุณารอตามที่ระบุใน Retry-After
500 Server Errorinternal_server_errorเกิดปัญหาภายในเซิร์ฟเวอร์ ลองใหม่ได้โดยเพิ่มระยะเวลารอเป็นลำดับ
503 Service Unavailablesns_provider_unavailableบริการเครือข่ายสังคมภายนอกขัดข้อง สามารถลองใหม่ได้ในภายหลัง

{
"error": "insufficient_scope",
"message": "The API key does not have the required 'publishing:create' scope."
}
{
"error": "idempotency_conflict",
"message": "Idempotency key 'launch-001' is already bound to a different request hash.",
"param": "idempotency_key"
}
{
"error": "sns_content_media_maximum_exceeded",
"message": "Bluesky supports a maximum of 4 images per post.",
"param": "media"
}

  • กรณีที่ลองใหม่ได้ (5xx, เครือข่ายหมดเวลา): ส่งคำขอเดิมซ้ำโดยใช้ idempotency_key เดิมทุกประการ และเพิ่มระยะเวลารอแบบเอ็กซ์โพเนนเชียลพร้อมค่าหน่วงแบบสุ่ม
  • กรณีที่ลองใหม่ไม่ได้ (400, 401, 403, 404, 409): แก้ไขโค้ดฝั่งไคลเอนต์หรือเพย์โหลด แล้วส่งคำขอใหม่ด้วย idempotency_key ชุดใหม่