CKAN Data API

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

エンドポイント »

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

作成 https://opendata.ugr.es/ja/api/3/action/datastore_create
更新 / 挿入 https://opendata.ugr.es/ja/api/3/action/datastore_upsert
クエリ https://opendata.ugr.es/ja/api/3/action/datastore_search
クエリ (SQL使用) https://opendata.ugr.es/ja/api/3/action/datastore_search_sql
クエリ »
クエリ例 (最初の5件)

https://opendata.ugr.es/ja/api/3/action/datastore_search?resource_id=1ff051f0-0b2f-4308-9283-6c27ba5e67d0&limit=5

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

https://opendata.ugr.es/ja/api/3/action/datastore_search?resource_id=1ff051f0-0b2f-4308-9283-6c27ba5e67d0&q=jones

クエリ例 (SQL文使用)

https://opendata.ugr.es/ja/api/3/action/datastore_search_sql?sql=SELECT * from "1ff051f0-0b2f-4308-9283-6c27ba5e67d0" WHERE title LIKE 'jones'

例: Javascript »

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

        var data = {
          resource_id: '1ff051f0-0b2f-4308-9283-6c27ba5e67d0', // the resource id
          limit: 5, // get 5 results
          q: 'jones' // query for 'jones'
        };
        $.ajax({
          url: 'https://opendata.ugr.es/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://opendata.ugr.es/ja/api/3/action/datastore_search?resource_id=1ff051f0-0b2f-4308-9283-6c27ba5e67d0&limit=5&q=title:jones'  
      fileobj = urllib.urlopen(url)
      print fileobj.read()