คู่มือการใช้งาน API ระบบข้อมูลสำนักงานการไฟฟ้าส่วนภูมิภาค เขต 1
ใช้ได้ฟรี ไม่ต้อง login — เหมาะสำหรับ Google Apps Script, n8n, Python, Excel
https://namepeaapi.pages.dev/api/v1
ค้นหาสำนักงาน กรองตามขนาด กฟจ. หรือจุดรวมงาน รองรับ pagination และ sorting
| ชื่อ | ค่า | คำอธิบาย |
|---|---|---|
| q optional | string | คำค้น: รหัส, ชื่อย่อ, ชื่อเต็ม |
| size | L, M, S, XS | กรองตามขนาด |
| group8 | string | กรองตาม กฟจ. เช่น G8_01 |
| groupCode | string | กรองตามจุดรวมงาน เช่น D01 |
| page | number | หน้า (default: 1) |
| limit | number | จำนวนต่อหน้า (default: 50, max: 200) |
| sort | code, shortName, fullName, size, index | เรียงตาม |
| order | asc, desc | ลำดับ (default: asc) |
curl "https://namepeaapi.pages.dev/api/v1/offices?q=อุดร&size=L"
ดึงข้อมูลสำนักงานจาก code เช่น D01101
curl "https://namepeaapi.pages.dev/api/v1/offices/D01101"
กรอกชื่อย่อ/ชื่อเต็ม/รหัส → จัดกลุ่มเป็นรูปแบบ กฟจ.(...), กฟส.(...) พร้อม copy ได้เลย
กฟส.รณ., เรณูนคร, รณ., D06202
| ชื่อ | ค่า | คำอธิบาย |
|---|---|---|
| names required | string | ชื่อสำนักงาน คั่นด้วย , เช่น กฟส.รณ.,กฟส.ภผม. |
# ชื่อย่อ
curl "https://namepeaapi.pages.dev/api/v1/tools/group-offices?names=กฟส.รณ.,กฟส.ภผม."
# ชื่อเต็ม
curl "https://namepeaapi.pages.dev/api/v1/tools/group-offices?names=เรณูนคร,ภูผาม่าน"
# Response:
# {
# "data": {
# "formatted": "กฟจ.(นพ.,ขก.),\nกฟส.(ธพ.,ชมพ.,รณ.,ภผม.)"
# }
# }
curl "https://namepeaapi.pages.dev/api/v1/stats"
# Response:
# {
# "data": {
# "totalOffices": 116,
# "bySize": {"L": 8, "M": 17, "S": 47, "XS": 44},
# ...
# }
# }
curl "https://namepeaapi.pages.dev/api/v1/hierarchy"
| ชื่อ | ค่า | คำอธิบาย |
|---|---|---|
| format required | csv, json | รูปแบบไฟล์ |
| q, size, group8, groupCode | string | filter เหมือน /offices |
# CSV (Excel-compatible, UTF-8 BOM) curl -o offices.csv "https://namepeaapi.pages.dev/api/v1/export/offices?format=csv" # JSON curl -o offices.json "https://namepeaapi.pages.dev/api/v1/export/offices?format=json" # พร้อม filter curl -o filtered.csv "https://namepeaapi.pages.dev/api/v1/export/offices?format=csv&size=L"
ทุก endpoint ตอบ JSON ในรูปแบบเดียวกัน:
{
"success": true,
"data": { ... }, // ข้อมูล
"meta": { // pagination / stats
"total": 116,
"page": 1,
"limit": 50
},
"error": null // null ถ้าสำเร็จ
}
// กรณี error:
{
"success": false,
"data": null,
"error": {
"code": "NOT_FOUND",
"message": "Office not found: XXX"
}
}