L o a d i n g
dwr Logo

ระบบเตือนภัยล่วงหน้า น้ำหลาก-ดินถล่ม EARLY WARNING SYSTEM

กรมทรัพยากรน้ำ - Department of Water Resource

WebService: Rain 12h and Daily (max)

Rain 12 hours and Daily (max) data service

Input

  • รหัสผู้ใช้ (uid)
  • รหัสผ่าน (upass)
  • ประเภทข้อมูล (dmode)
    • dmode = 1 ข้อมูลปริมาณน้ำฝน 12 ชม.
    • dmode = 2 ข้อมูลปริมาณน้ำฝนรายวัน
  • รูปแบบข้อมูล (dtype)
    • dtype = 1 รูปแบบข้อมูล XML
    • dtype = 2 รูปแบบข้อมูล JSON
  • วันที่ (ondate)
    ถ้าระดับผู้ใช้ คือ user ข้อมูลคือวันที่ล่าสุดเท่านั้น
    ถ้าระดับผู้ใช้ คือ admin สามารถระบุวันที่ได้ดังนี้
    ondate = dd/mm/yyyy

Output

XML format

<ews>
  <title>หัวข้อ</title>
  <numstation>จำนวนสถานี</numstation>
  <date>วันที่ของข้อมูล</date>
  <department>หน่วยงาน</department>
    <station id="รหัสสถานี" order="ลำดับที่">
      <village>หมู่บ้าน</village>
      <subdistrict>ตำบล</subdistrict>
      <district>อำเภอ</district>
      <province>จังหวัด</province>
      <rain12h>ฝนราย 12 ชม.</rain12h>
      <rain07h>ฝนรายวัน เวลา 07:00</rain07h>
      <temp>อุณหภูมิ</temp>
      <wl>ระดับน้ำ</wl>
      <soil>ความชื้น</soil>
    </station>
</ews>

JSON format

{
  "title": "หัวข้อ",
  "numstation": "จำนวนสถานี",
  "date": "วันที่ของข้อมูล",
  "department": "หน่วยงาน",
  "station": [
    {
      "order": "ลำดับที่",
      "id": "รหัสสถานี",
      "village": "หมู่บ้าน",
      "subdistrict": "ตำบล",
      "district": "อำเภอ",
      "province": "จังหวัด",
      "rain12h": "ฝนราย 12 ชม.",
      "rain07h": "ฝนรายวัน เวลา 07:00",
      "temp": "อุณหภูมิ",
      "wl": "ระดับน้ำ",
      "soil": "ความชื้น"
    }
  ]
}

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 user or admin

  • XML format: <error>User level must be User or Admin only</error>
  • JSON format: {"error": "User level must be User or Admin only"}

Examples

Base URL: http://202.129.59.84/ews/web-service/rain-daily

Example URL with parameters:

http://202.129.59.84/ews/web-service/rain-daily?uid=user&upass=password&dmode=1&dtype=1&ondate=dd/mm/yyyy