เปิดลิงก์ย่อ (Redirect) GET
endpoint ที่ผู้รับ SMS เข้าถึงเมื่อกดลิงก์ย่อ — ระบบนับคลิก แล้วพาเบราว์เซอร์ไปยัง URL ปลายทาง โดยปกติคุณไม่ต้องเรียกเอง เพียงใส่ shortUrl ที่ได้จาก สร้างลิงก์ย่อ ลงในข้อความ
Authorization
ไม่ต้องยืนยันตัวตน (public) — ผู้รับเปิดลิงก์ได้โดยตรง
HTTP Request
http
GET https://public-api.smsup-plus.com/s/{code}ลิงก์ที่ส่งให้ผู้รับคือค่า shortUrl จาก response ของ สร้างลิงก์ย่อ (โดเมนลิงก์ย่อ + shortCode) ให้ใช้ค่านั้นตามที่ได้รับ
Content Type
ไม่มี body — ส่งค่าผ่าน path
Parameter Description
| Property | Type | Required | Description |
|---|---|---|---|
code | string (path) | Required | shortCode ของลิงก์ (ตรงตามตัวพิมพ์เล็ก-ใหญ่) |
Response Description
| Property | Type | Description |
|---|---|---|
| HTTP status | — | 302 Found เมื่อพบลิงก์ |
Location (header) | string | URL ปลายทาง (originalUrl) — เบราว์เซอร์จะไปยัง URL นี้อัตโนมัติ |
ทุกครั้งที่ redirect สำเร็จ clickCount ของลิงก์จะเพิ่มขึ้น 1 (ดูได้ที่ สถิติลิงก์ย่อ)
ตัวอย่าง Request
bash
curl -i 'https://public-api.smsup-plus.com/s/aB3dE9xZ'js
const res = await fetch('https://public-api.smsup-plus.com/s/aB3dE9xZ', { redirect: 'manual' })
console.log(res.status, res.headers.get('location'))ตัวอย่าง Response
http
HTTP/1.1 302 Found
Location: https://www.example.com/promotion?utm_source=smsError ที่อาจเจอ
| HTTP | Response | สาเหตุ |
|---|---|---|
| 404 | {"status":404,"description":"short URL not found"} | ไม่พบ code นี้ หรือลิงก์ถูกปิดใช้งานแล้ว — ผู้รับจะเห็นข้อความ JSON นี้ในเบราว์เซอร์ |
INFO
ระบบใช้ 302 (ไม่ใช่ 301) เพื่อไม่ให้เบราว์เซอร์จำ redirect ไว้ ทุกการเปิดลิงก์จึงถูกนับคลิก และลิงก์ที่ถูกปิดใช้งานจะหยุดทำงานทันที
TIP
การทดสอบด้วยเครื่องมือที่ตาม redirect อัตโนมัติ (เช่น เบราว์เซอร์) ก็นับเป็นคลิกด้วย
