パワフルなクエリサポートがあるweb APIを通してリソースデータにアクセス. より詳しい情報は main CKAN Data API and DataStore documentationを参照してください。
Data APIはCKAN action APIの次のようなアクションを通してアクセスすることができます。
作成 | https://ckan.hoda.jp/ja/api/3/action/datastore_create |
---|---|
更新 / 挿入 | https://ckan.hoda.jp/ja/api/3/action/datastore_upsert |
クエリ | https://ckan.hoda.jp/ja/api/3/action/datastore_search |
クエリ (SQL使用) | https://ckan.hoda.jp/ja/api/3/action/datastore_search_sql |
https://ckan.hoda.jp/ja/api/3/action/datastore_search?resource_id=e07321cc-cd8b-42c7-af8e-cc211a9ca55d&limit=5
https://ckan.hoda.jp/ja/api/3/action/datastore_search?resource_id=e07321cc-cd8b-42c7-af8e-cc211a9ca55d&q=jones
https://ckan.hoda.jp/ja/api/3/action/datastore_search_sql?sql=SELECT * from "e07321cc-cd8b-42c7-af8e-cc211a9ca55d" WHERE title LIKE 'jones'
jQueryを使用したdata APIへの単純なajax (JSONP) リクエスト
var data = { resource_id: 'e07321cc-cd8b-42c7-af8e-cc211a9ca55d', // the resource id limit: 5, // get 5 results q: 'jones' // query for 'jones' }; $.ajax({ url: 'https://ckan.hoda.jp/ja/api/3/action/datastore_search', data: data, dataType: 'jsonp', success: function(data) { alert('Total results found: ' + data.result.total) } });
import urllib url = 'https://ckan.hoda.jp/ja/api/3/action/datastore_search?resource_id=e07321cc-cd8b-42c7-af8e-cc211a9ca55d&limit=5&q=title:jones' fileobj = urllib.urlopen(url) print fileobj.read()