WebService: Daily rain (last 7 days)
Daily rain data service (last 7 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>
<rain24h>ฝน 1 วัน</rain24h>
<rain48h>ฝน 2 วัน</rain48h>
<rain72h>ฝน 3 วัน</rain72h>
<rain96h>ฝน 4 วัน</rain96h>
<rain120h>ฝน 5 วัน</rain120h>
<rain144h>ฝน 6 วัน</rain144h>
<rain168h>ฝน 7 วัน</rain168h>
</station>
</ews>
JSON format
{
"title": "หัวข้อ",
"numstation": "จำนวนสถานี",
"date": "วันที่ของข้อมูล",
"department": "หน่วยงาน",
"station": [
{
"order": "ลำดับที่",
"id": "รหัสสถานี",
"village": "หมู่บ้าน",
"subdistrict": "ตำบล",
"district": "อำเภอ",
"province": "จังหวัด",
"rain": "ฝนราย 15 นาที",
"rain12h": "ฝนราย 12 ชม.",
"rain24h": "ฝน 1 วัน",
"rain48h": "ฝน 2 วัน",
"rain72h": "ฝน 3 วัน",
"rain96h": "ฝน 4 วัน",
"rain120h": "ฝน 5 วัน",
"rain144h": "ฝน 6 วัน",
"rain168h": "ฝน 7 วัน"
}
]
}
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-weekly
Example URL with parameters:
http://202.129.59.84/ews/web-service/rain-weekly?uid=user&upass=password&dtype=1&status=rainstatus