パワフルなクエリサポートがある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 |
jQueryを使用したdata APIへの単純なajax (JSONP) リクエスト
var data = { resource_id: '0a70600f-dc5b-4095-b527-90040f8ed8ce', // 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) } });
import urllib url = 'https://gdcatalognhic.nha.co.th/ja/api/3/action/datastore_search?limit=5&resource_id=0a70600f-dc5b-4095-b527-90040f8ed8ce&q=title:jones' fileobj = urllib.urlopen(url) print fileobj.read()