CKAN Data API

Pristupi podacima resursa putem veb API-ja za moćnom podrškom za upite. Further information in the main CKAN Data API and DataStore documentation.

The Data API can be accessed via the following actions of the CKAN action API.

Kreiraj http://ckan.hoda.jp/sr_Latn/api/3/action/datastore_create
Ažuriraj / Ubaci http://ckan.hoda.jp/sr_Latn/api/3/action/datastore_upsert
Upit http://ckan.hoda.jp/sr_Latn/api/3/action/datastore_search

Primer upita (prvih 5 rezultata)

http://ckan.hoda.jp/sr_Latn/api/3/action/datastore_search?resource_id=1e554f8a-0faf-46e0-a79d-904f20e55bc0&limit=5

Primer upita (rezultati koji sadrže 'jones')

http://ckan.hoda.jp/sr_Latn/api/3/action/datastore_search?resource_id=1e554f8a-0faf-46e0-a79d-904f20e55bc0&q=jones

Jednostavan ajax (JSONP) zahtev za API podatke koristeći jQuery.

          var data = {
            resource_id: '1e554f8a-0faf-46e0-a79d-904f20e55bc0', // the resource id
            limit: 5, // get 5 results
            q: 'jones' // query for 'jones'
          };
          $.ajax({
            url: 'http://ckan.hoda.jp/sr_Latn/api/3/action/datastore_search',
            data: data,
            dataType: 'jsonp',
            success: function(data) {
              alert('Total results found: ' + data.result.total)
            }
          });
        import urllib.request
        url = 'http://ckan.hoda.jp/sr_Latn/api/3/action/datastore_search?resource_id=1e554f8a-0faf-46e0-a79d-904f20e55bc0&limit=5&q=title:jones'  
        fileobj = urllib.request.urlopen(url)
        print(fileobj.read())