ระบบพิมพ์เกียรติบัตรออนไลน์
สำนักงานเขตพื้นที่การศึกษามัธยมศึกษาอุทัยธานี ชัยนาท
เอกสารการใช้งาน API (API Documentation)
บริการสำหรับเว็บไซต์หรือระบบภายนอกที่ต้องการเชื่อมต่อเพื่อค้นหาข้อมูลเกียรติบัตรของผู้รับบริการในระบบนี้
1. ข้อมูลการเรียกใช้งาน (Endpoint Details)
| API URL |
https://spmuncn.obec.go.th/cert/api/search.php |
|---|---|
| Method | GET POST |
| CORS Support | รองรับการเรียกข้ามโดเมน (Enabled) |
2. พารามิเตอร์ที่รองรับ (Request Parameters)
* หมายเหตุ: ต้องส่งพารามิเตอร์ค้นหาอย่างน้อย 1 รายการ
| ชื่อพารามิเตอร์ | ประเภทข้อมูล | ความจำเป็น | รายละเอียด / ตัวอย่าง |
|---|---|---|---|
firstnameTH |
String | ทางเลือก | ชื่อจริงภาษาไทย (ไม่ต้องใส่คำนำหน้า เช่น วัชรพัฐ) |
lastnameTH |
String | ทางเลือก | นามสกุลภาษาไทย (เช่น มะธิตะโน) |
firstnameEN |
String | ทางเลือก | ชื่อจริงภาษาอังกฤษ (เช่น Watcharapat) |
lastnameEN |
String | ทางเลือก | นามสกุลภาษาอังกฤษ (เช่น Mathitano) |
3. ตัวอย่างการเรียกใช้งาน (Usage Examples)
URL สำหรับทดสอบ:
https://spmuncn.obec.go.th/cert/api/search.php?firstnameTH=%E0%B8%A7%E0%B8%B1%E0%B8%8A%E0%B8%A3%E0%B8%9E%E0%B8%B1%E0%B8%90&lastnameTH=%E0%B8%A1%E0%B8%B0%E0%B8%98%E0%B8%B4%E0%B8%95%E0%B8%B0%E0%B9%82%E0%B8%99&firstnameEN=Watcharapat&lastnameEN=Mathitano
ทดสอบเรียกใช้ (Try it out)
ตัวอย่างโค้ด JavaScript (Fetch API):
fetch("https://spmuncn.obec.go.th/cert/api/search.php?firstnameTH=วัชรพัฐ&lastnameTH=มะธิตะโน")
.then(response => response.json())
.then(result => {
if(result.success) {
console.log("พบรายการเกียรติบัตร: " + result.count + " รายการ");
console.log(result.data);
} else {
console.error(result.error);
}
})
.catch(error => console.error("Error:", error));
4. ข้อมูลตอบกลับ (JSON Response Format)
{
"success": true,
"count": 1,
"data": [
{
"id": 12345,
"participant_name": "นายวัชรพัฐ มะธิตะโน",
"certificate_no": "สพม.อนชน.นตป.2569.190/1",
"line2": "ได้รับรางวัลเกียรติยศระดับดีเยี่ยม",
"line3": "",
"project": {
"id": 190,
"name": "การประกวดโครงงานนวัตกรรมดิจิทัล",
"date": "2026-06-12",
"department": "กลุ่มนิเทศ ติดตาม และประเมินการจัดการศึกษา"
},
"background_url": "https://spmuncn.obec.site/cert/upload/tempate/cert_pj-190.png",
"print_url": "https://spmuncn.obec.site/cert/print.php?id=190&learn=12345"
}
]
}