API สำหรับอ่านข้อมูลสารสนเทศสถานีตรวจวัด
การกำหนดรายละเอียดของ API สำหรับอ่านข้อมูลสารสนเทศสถานีตรวจวัด
| API ID | URL | รายละเอียด |
|---|---|---|
| B001.1 | /StationInfo | อ่านข้อมูลสารสนเทศสถานีตรวจวัดตามเงื่อนไข |
| B001.2 | /StationInfo/{stationCode} | อ่านข้อมูลสารสนเทศสถานีตรวจวัดตามรหัสสถานีตรวจวัด |
คุณลักษณะ API สำหรับอ่านข้อมูลสารสนเทศสถานีตรวจวัดตามเงื่อนไข
API ID: B001.1
วัตถุประสงค์: ค้นหาอ่านข้อมูลสารสนเทศสถานีตรวจวัดตามเงื่อนไข
Status: Required (ตั้งแต่ API version 1.0 Draft 1)
Since: 1.0 Draft 1
Revision: 1.0 Draft 1
ข้อมูลทั่วไปในการติดต่อ API สําหรับอ่านข้อมูลสารสนเทศสถานีตรวจวัดตามเงื่อนไข
| ข้อมูล | รายละเอียด |
|---|---|
| URL | /StationInfo |
| HTTP Method | GET |
Query parameter ของ API สำหรับอ่านข้อมูลสารสนเทศสถานีตรวจวัดตามเงื่อนไข
| ลำดับ | Parameter | Type | ความหมาย | หมายเหตุ |
|---|---|---|---|---|
| 1 | stationCode | string | รหัสสถานีตรวจวัดของหน่วยงาน ดูหัวข้อรหัสสถานีตรวจวัด | optional |
| 2 | agencyCode | string | รหัสหน่วยงาน ดูหัวข้อรหัสหน่วยงาน | optional |
| 3 | provinceCode | string | รหัสจังหวัด (2 หลัก) ดูหัวข้อการอ้างอิงจังหวัด | optional |
| 4 | amphoeCode | string | รหัสอำเภอ (4 หลัก) ดูหัวข้อการอ้างอิงอำเภอ | optional |
| 5 | tambonCode | string | รหัสตำบล (6 หลัก) ดูหัวข้อการอ้างอิงตำบล | optional |
| 6 | basinCode | string | รหัสลุ่มน้ำหลัก (2 หลัก) ดูหัวข้อการอ้างอิงลุ่มน้ำหลัก/ลุ่มน้ำสาขา | optional |
| 7 | subBasinCode | string | รหัสลุ่มน้ำสาขา (4 หลัก) ดูหัวข้อการอ้างอิงลุ่มน้ำหลัก/ลุ่มน้ำสาขา | optional |
ตัวอย่าง HTTP Request Parameter ระบุรหัสสถานีตรวจวัด
stationCode= G07003-35061
ตัวอย่าง HTTP Request Parameter ระบุรหัสสถานีตรวจวัดร่วมกับรหัสจังหวัด
agencyCode = G07003
&provinceCode = 15
หมายเหตุ
มีการขึ้นบรรทัดสำหรับ Parameter และไม่ได้ทำ HTTP URL Encode เพื่อให้ง่ายต่อการอ่าน
คุณลักษณะ API สำหรับอ่านข้อมูลสารสนเทศสถานีตรวจวัดตามรหัสสถานีตรวจวัด
API ID: B001.2
วัตถุประสงค์: อ่านรายละเอียดข้อมูลสารสนเทศสถานีตรวจวัดตามรหัสสถานีตรวจวัด
Status: Required (ตั้งแต่ API version 1.0 Draft 1)
Since: 1.0 Draft 1
Revision: 1.0 Draft 1
ข้อมูลทั่วไปในการติดต่อ API สำหรับอ่านข้อมูลสารสนเทศสถานีตรวจวัดตามรหัสสถานีตรวจวัด
| ข้อมูล | รายละเอียด |
|---|---|
| URL | /StationInfo/{stationCode} |
| HTTP Method | GET |
หมายเหตุ
stationCode – รหัสสถานีตรวจวัดของหน่วยงาน อ้างอิงหัวข้อรหัสสถานีตรวจวัด
โครงสร้างของ Response body ข้อมูลสารสนเทศสถานีตรวจวัดจาก API
{
"metadata": {
"version": string,
"dataProviderCode": string,
"dataProviderName": string,
"documentGenerateTime": datetime,
"waterDatatype": string
},
"station": [{
"stationMetadata":
{
"stationOwnerCode": string,
"stationOwnerName": string,
"stationCode": string,
"stationName": string,
"stationType": string,
"stationDescription": string,
"stationOperatingStatus": integer,
"lastMaintenance": date,
"locationCode": string,
"latitude": decimal,
"longitude": decimal,
"altitude": decimal,
"subBasinCode": string,
"numOfInstruments": integer
},
"lastUpdateTime": datetime,
"instrument": [
{
"instrumentID": string,
"instrumentDescription": string
}
],
"waterCourse": {
"waterCourseName": string,
"ratingCurve":ratingcurve,
"crossSectionArea":decimal
}
}
]
}
หมายเหตุ
ในกรณีที่ ข้อมูลตามโครงสร้างมาตรฐานไม่ได้กําหนดเป็น Mandatory (ดูหัวข้อโครงสร้างข้อมูลสารสนเทศสถานีตรวจวัด Station Information) ถ้ามีข้อมูล สามารถส่งข้อมูลนั้นๆได้ตามโครงสร้าง แต่ในกรณีที่ไม่มีข้อมูล API จะไม่ส่งข้อมูลกลับออกมา
ตัวอย่าง HTTP Response Body ข้อมูลสารสนเทศสถานีตรวจวัดจาก API
{
"metadata": {
"version": "1.0",
"dataProviderCode": "G50601",
"dataProviderName": "Metropolitan Waterworks Authority",
"documentGenerateTime": "2023-05-02T22:00:00",
"waterDatatype": "B001"
},
"station": [
{
"stationMetadata": {
"stationOwnerCode": "G50601",
"stationOwnerName": "Metropolitan Waterworks Authority",
"stationCode": "G50601-S1",
"stationName": "สําแล",
"stationType": "คุณภาพน้ํา",
"stationDescription": "สถานีตรวจวัดคุณภาพน้ําแม่น้ําเจ้าพระยา",
"stationOperatingStatus": 1,
"lastMaintenance": "2023-01-10",
"locationCode": "130105",
"latitude": 14.040830,
"longitude": 100.555875,
"numOfInstrument": 1
},
"lastUpdateTime": "2022-09-10T09:00:00",
"instrument": [
{
"instrumentDescription": "Multisensor"
}
],
"waterCourse": {
"waterCourseName": "แม่น้ําเจ้าพระยา"
}
}
]
}
หมายเหตุ
ข้อมูลที่ใส่ในตัวอย่างเป็นข้อมูลจำลองเพื่อประกอบความเข้าใจในการทำงานของ API เท่านั้น อาจจะไม่ตรงกับการใช้งานจริง