CKAN Data API

パワフルなクエリサポートがあるweb APIを通してリソースデータにアクセス. より詳しい情報は main CKAN Data API and DataStore documentationを参照してください。

エンドポイント »

Data APIはCKAN action APIの次のようなアクションを通してアクセスすることができます。

作成 https://gdcatalognhic.nha.co.th/ja/api/3/action/datastore_create
更新 / 挿入 https://gdcatalognhic.nha.co.th/ja/api/3/action/datastore_upsert
クエリ https://gdcatalognhic.nha.co.th/ja/api/3/action/datastore_search
クエリ » (จำกัดผลลัพธ์ 10,000 เรคคอร์ด)
クエリ例 (最初の5件)

https://gdcatalognhic.nha.co.th/ja/api/3/action/datastore_search?limit=5&resource_id=a4bd6ef7-b397-4153-b789-4f259977282a

クエリ例 ('jones'を含む結果)

https://gdcatalognhic.nha.co.th/ja/api/3/action/datastore_search?q=jones&resource_id=a4bd6ef7-b397-4153-b789-4f259977282a

例: Javascript »

jQueryを使用したdata APIへの単純なajax (JSONP) リクエスト

        var data = {
          resource_id: 'a4bd6ef7-b397-4153-b789-4f259977282a', // the resource id
          limit: 5, // get 5 results
          q: 'jones' // query for 'jones'
        };
        $.ajax({
          url: 'https://gdcatalognhic.nha.co.th/ja/api/3/action/datastore_search',
          data: data,
          dataType: 'jsonp',
          success: function(data) {
            alert('Total results found: ' + data.result.total)
          }
        });
例: Python »
      import urllib
      url = 'https://gdcatalognhic.nha.co.th/ja/api/3/action/datastore_search?limit=5&resource_id=a4bd6ef7-b397-4153-b789-4f259977282a&q=title:jones'  
      fileobj = urllib.urlopen(url)
      print fileobj.read()