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