CKAN Data API

ดูรายละเอียดเพิ่มเติมใน เอกสารคู่มือการใช้งาน Data.go.th API

Query example (first 5 results)

https://opend.data.go.th/get-ckan/datastore_search?resource_id=3ffaa062-f437-4f44-bfe1-1724dd3cb8cd&limit=5

Query example (results containing 'jones')

https://opend.data.go.th/get-ckan/datastore_search?resource_id=3ffaa062-f437-4f44-bfe1-1724dd3cb8cd&q=jones

A simple ajax (JSONP) request to the data API using jQuery.

          var data = {
            resource_id: '3ffaa062-f437-4f44-bfe1-1724dd3cb8cd', // the resource id
            limit: 5, // get 5 results
            q: 'jones' // query for 'jones'
          };
          $.ajax({
            url: 'https://opend.data.go.th/get-ckan/datastore_search',
            data: data,
            dataType: 'jsonp',
            success: function(data) {
              alert('Total results found: ' + data.result.total)
            }
          });
        import urllib.request
        url = 'https://opend.data.go.th/get-ckan/datastore_search?resource_id=3ffaa062-f437-4f44-bfe1-1724dd3cb8cd&limit=5&q=title:jones'  
        fileobj = urllib.request.urlopen(url)
        print(fileobj.read())