ลบช่องทางติดต่อ POST
ลบช่องทางติดต่อ (destination) ที่เคยเพิ่มไว้กับรายชื่อผู้ติดต่อ
Authorization
ใช้ API Key (การยืนยันตัวตน) — ส่ง header Authorization: Bearer <API_KEY> (API Key ขึ้นต้นด้วย smsk_)
HTTP Request
http
POST https://public-api.smsup-plus.com/Person/DeletePersonDestinationContent Type
application/json
Parameter Description
| Property | Type | Required | Description |
|---|---|---|---|
destinationId | string | Required | รหัสช่องทางติดต่อที่ได้จากเพิ่มช่องทางติดต่อ (ต้องเป็นของบัญชีคุณ) |
Response Description
| Property | Type | Description |
|---|---|---|
status | number | 200 เมื่อสำเร็จ |
description | string | Destination deleted. |
ตัวอย่าง Request
bash
curl -X POST 'https://public-api.smsup-plus.com/Person/DeletePersonDestination' \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"destinationId": "7e6d5c4b-3a29-4180-9f7e-6d5c4b3a2918"
}'js
const res = await fetch('https://public-api.smsup-plus.com/Person/DeletePersonDestination', {
method: 'POST',
headers: { Authorization: 'Bearer <API_KEY>', 'Content-Type': 'application/json' },
body: JSON.stringify({ destinationId: '7e6d5c4b-3a29-4180-9f7e-6d5c4b3a2918' }),
})
console.log(await res.json())ตัวอย่าง Response
json
{
"status": 200,
"description": "Destination deleted."
}Error ที่อาจเจอ
| HTTP | Response | สาเหตุ |
|---|---|---|
| 200 | {"status":400,"description":"destinationId is required."} | ไม่ได้ส่ง destinationId หรือ body ไม่ใช่ JSON |
| 200 | {"status":404,"description":"Destination not found."} | ไม่พบช่องทางติดต่อ ถูกลบไปแล้ว หรือไม่ใช่ของบัญชีคุณ |
| 200 | {"status":500,"description":"Failed to delete destination."} | ลบไม่สำเร็จ ลองใหม่อีกครั้ง |
| 401 | {"error":"invalid api key"} | API Key ไม่ถูกต้อง — ดู Error |
WARNING
เมื่อผ่านการยืนยันตัวตนแล้ว endpoint นี้ตอบ HTTP 200 เสมอ ให้ตรวจผลจากฟิลด์ status ใน body
TIP
path นี้ขึ้นต้นด้วยตัว D ใหญ่ (DeletePersonDestination) และตัวพิมพ์เล็ก-ใหญ่มีผล — เรียก /Person/deletePersonDestination จะได้ 404
