WebService: Daily rain (last 30 days)
Daily rain data service (last 30 days)
Input
- รหัสผู้ใช้ (uid)
- รหัสผ่าน (upass)
- รูปแบบข้อมูล (dtype)
dtype = 1รูปแบบข้อมูล XMLdtype = 2รูปแบบข้อมูล JSON
- สถานะฝน (status)
status = 3อพยพstatus = 2เตือนภัยstatus = 1เฝ้าระวังstatus = 9มีฝนstatus = 0ไม่มีฝนstatus = -999เชื่อมต่อสัญญาณ
Output
XML format
<ews>
<title>หัวข้อ</title>
<numstation>จำนวนสถานี</numstation>
<date>วันที่ของข้อมูล</date>
<department>หน่วยงาน</department>
<station id="รหัสสถานี" order="ลำดับที่">
<village>หมู่บ้าน</village>
<subdistrict>ตำบล</subdistrict>
<district>อำเภอ</district>
<province>จังหวัด</province>
<rain>ฝนราย 15 นาที</rain>
<rain12h>ฝนราย 12 ชม.</rain12h>
<rainday01>ฝนวันที่01</rainday01>
<rainday02>ฝนวันที่02</rainday02>
<!-- เพิ่มไปจนถึงวันที่ 30 -->
<rainday30>ฝนวันที่30</rainday30>
</station>
</ews>
JSON format
{
"title": "หัวข้อ",
"numstation": "จำนวนสถานี",
"date": "วันที่ของข้อมูล",
"department": "หน่วยงาน",
"station": [
{
"order": "ลำดับที่",
"id": "รหัสสถานี",
"village": "หมู่บ้าน",
"subdistrict": "ตำบล",
"district": "อำเภอ",
"province": "จังหวัด",
"rain": "ฝนราย 15 นาที",
"rain12h": "ฝนราย 12 ชม.",
"rainday01": "ฝนวันที่ 01",
"rainday02": "ฝนวันที่ 02",
// เพิ่มไปจนถึงวันที่ 30
"rainday30": "ฝนวันที่ 30"
}
]
}
Error Handling
If the input is invalid, the output will be returned as follows:
Invalid user ID or password, or not registered in Webservice
- XML format:
<error>Invalid user ID or password</error> - JSON format:
{"error": "Invalid user ID or password"}
User level is not admin
- XML format:
<error>User level must be Admin only</error> - JSON format:
{"error": "User level must be Admin only"}
Examples
Base URL = http://202.129.59.84/ews/web-service/rain-monthly
Example URL with parameters
http://202.129.59.84/ews/web-service/rain-monthly?uid=user&upass=password&dtype=1&status=rainstatus