パワフルなクエリサポートがある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=ad355721-9fbf-4b20-a644-0d85d2556af5&limit=5
https://ckan.hoda.jp/ja/api/3/action/datastore_search?resource_id=ad355721-9fbf-4b20-a644-0d85d2556af5&q=jones
https://ckan.hoda.jp/ja/api/3/action/datastore_search_sql?sql=SELECT * from "ad355721-9fbf-4b20-a644-0d85d2556af5" WHERE title LIKE 'jones'
jQueryを使用したdata APIへの単純なajax (JSONP) リクエスト
var data = { resource_id: 'ad355721-9fbf-4b20-a644-0d85d2556af5', // 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=ad355721-9fbf-4b20-a644-0d85d2556af5&limit=5&q=title:jones' fileobj = urllib.urlopen(url) print fileobj.read()