การกู้คืนแบบกลุ่ม v3
วัตถุประสงค์ของฟังก์ชัน API นี้คือการกู้คืนหมายเลขโทรศัพท์แบบกลุ่ม POST: https://api.multitel.net/v3/bulk_restore - การยืนยันตัวตน: HTTP basic ด้วยข้อมูลประจำตัว API ของผู้ใช้ - เนื้อหา (application/json): {
"numbers":
[
"15551230111",
"15551230112",
"15551230113"
],
"webhook_url": "https://client.example.com/restore-hook"
} - รองรับสตริงที่เป็นตัวเลขเท่านั้น โดย numbers_text (คั่นด้วยการขึ้นบรรทัดใหม่) ก็ใช้งานได้เช่นกัน - หมายเลข 10 หมายเลขหรือน้อยกว่า → ดำเนินการแบบ synchronous มากกว่า 10 หมายเลข → เข้าคิวและประมวลผลโดย service worker - การตอบกลับแบบ synchronous (เป็นไปได้เฉพาะเมื่อระบุหมายเลข 10 หมายเลขหรือน้อยกว่า): {
"job_uuid": "8f6c1f0e-23d2-4717-8c8e-1a518e5738f0",
"status": "completed",
"total_numbers": 3,
"success_count": 1,
"failure_count": 2,
"webhook_url": "https://client.example.com/restore-hook",
"created_at": "2025-10-28 12:31:45",
"started_at": "2025-10-28 12:31:45",
"completed_at": "2025-10-28 12:31:48",
"results": [
{
"number": "15551230111",
"status": "success",
"message": "Number restored",
"status_code": 200,
"requires_identity_update": 0
},
{
"number": "15551230112",
"status": "failed",
"message": "Error: 'restore failed, please contact support'",
"status_code": 500,
"requires_identity_update": 0
},
{
"number": "15551230113",
"status": "success",
"message": "Number restored",
"status_code": 200,
"requires_identity_update": 1,
"needs_registration": 1
}
]
} ในกรณีที่มีข้อผิดพลาดในการประมวลผลข้อมูล (หมดเวลา ไม่สามารถแปลงชื่อโดเมนผ่าน DNS ได้ เป็นต้น) ข้อผิดพลาดจะถูกส่งกลับหลังจากอาร์เรย์ “results”: "webhook_error":"Could not resolve host: asidhaiufsd0uf.multitel.net" หรือ หากระบุหมายเลขมากกว่า 10 หมายเลข: - เข้าคิวแล้ว (202 Accepted): {
"job_uuid": "c5bc4f3a-7b0a-4d5d-9f7e-d3fd87f41a00",
"status": "pending",
"total_numbers": 25,
"webhook_url": "https://client.example.com/restore-hook",
"message": "Restore job queued. Results will be POSTed to https://client.example.com/restore-hook"
} - ข้อมูล webhook จะเหมือนกับโครงสร้าง synchronous สุดท้ายทุกประการ (รวมถึงรหัสสถานะและข้อความรายหมายเลข) การตรวจสอบสถานะ - GET https://api.multitel.net/v3/bulk_restore_status - ต้องระบุ job_uuid ส่วน number เป็นทางเลือก (ตัวเลขเท่านั้น) - การตอบกลับจะสะท้อนสรุปงานพร้อมสถานะรายหมายเลขปัจจุบัน รวมถึงความพยายามและเวลาประทับ โดยตัวกรอง number จะส่งกลับเฉพาะรายการนั้น - ตัวอย่าง: GET …/bulk_restore_status?job_uuid=8f6c1f0e-23d2-4717-8c8e-1a518e5738f0 - แบบกรองแล้ว: GET …/bulk_restore_status?job_uuid=…&number=15551230113 - GET https://api.multitel.net/v3/bulk_restore_status - การยืนยันตัวตน: ใช้ HTTP Basic เดียวกับคำเรียก v3 อื่น ๆ - พารามิเตอร์คิวรี: - job_uuid (จำเป็น) – ได้จากการตอบกลับของ POST - number (ทางเลือก) – ตัวเลขเท่านั้น จำกัดผลลัพธ์ให้เหลือ DID เดียว - การตอบกลับจะสะท้อนข้อมูล webhook และขณะนี้รวมถึง requires_identity_update (1/0) พร้อม needs_registration เมื่อเกี่ยวข้อง ตัวอย่าง: {
"job_uuid": "8f6c1f0e-23d2-4717-8c8e-1a518e5738f0",
"status": "processing",
"total_numbers": 25,
"success_count": 10,
"failure_count": 0,
"webhook_url": "https://client.example.com/restore-hook",
"created_at": "2025-10-28 12:31:45",
"started_at": "2025-10-28 12:31:45",
"completed_at": null,
"results": [
{
"number": "15551230111",
"status": "success",
"message": "Number restored",
"status_code": 200,
"attempts": 1,
"started_at": "2025-03-28 12:31:45",
"completed_at": "2025-03-28 12:31:47",
"requires_identity_update": 0
},
{
"number": "15551230112",
"status": "failed",
"message": "Error: 'restore failed, please contact support'",
"status_code": 500,
"attempts": 1,
"started_at": "2025-03-28 12:31:45",
"completed_at": "2025-03-28 12:31:46",
"requires_identity_update": 0
},
{
"number": "15551230113",
"status": "success",
"message": "Number restored",
"status_code": 200,
"attempts": 1,
"started_at": "2025-03-28 12:31:45",
"completed_at": "2025-03-28 12:31:48",
"requires_identity_update": 1,
"needs_registration": 1
}
]
} - เมื่อใช้ number=15551230113 อาร์เรย์ results จะมีเฉพาะรายการนั้นพร้อม filtered_number ในข้อมูล หากคุณต้องการสร้างฟังก์ชันกู้คืนแบบกลุ่มด้วยตนเอง คุณสามารถใช้ปลายทาง API สำหรับหมายเลขเดียวด้านล่าง และเรียกซ้ำสำหรับแต่ละหมายเลขที่ต้องการกู้คืน curl -u 'USERNAME:PASSWORD' \
-H 'Accept: application/json' \
https://api.multitel.net/v3/restore/447000123456