Open Data API

เข้าถึงทรัพยากรข้อมูลผ่าน API ของเว็บด้วยภาษาสอบถามที่ทรงพลัง.

กำลังเรียกข้อมูล » (จำกัดผลลัพธ์ 10,000 เรคคอร์ด)
ตัวอย่างเรียกข้อมูล (5 ผลลัพธ์แรก)

https://opendata.mea.or.th/th/api/3/action/datastore_search?limit=5&resource_id=9461b793-7605-4bdf-92b7-aa4829b4c550

ตัวอย่างเรียกข้อมูล (ผลลัพธ์มีคำว่า 'jones')

https://opendata.mea.or.th/th/api/3/action/datastore_search?q=jones&resource_id=9461b793-7605-4bdf-92b7-aa4829b4c550

ตัวอย่าง: Javascript »

คำขอแบบ ajax (JSONP) พื้นฐาน เพื่อร้องขอข้อมูลผ่าน API โดยใช้ jQuery

        var data = {
          resource_id: '9461b793-7605-4bdf-92b7-aa4829b4c550', // the resource id
          limit: 5, // get 5 results
          q: 'jones' // query for 'jones'
        };
        $.ajax({
          url: 'https://opendata.mea.or.th/th/api/3/action/datastore_search',
          data: data,
          dataType: 'jsonp',
          success: function(data) {
            alert('Total results found: ' + data.result.total)
          }
        });
ตัวอย่าง: Python »
      import urllib
      url = 'https://opendata.mea.or.th/th/api/3/action/datastore_search?limit=5&resource_id=9461b793-7605-4bdf-92b7-aa4829b4c550&q=title:jones'  
      fileobj = urllib.urlopen(url)
      print fileobj.read()