CKAN API podataka

Pristup resursima podataka kroz web API uz široku podršku upita. Further information in the main CKAN Data API and DataStore documentation.

API-ju podataka je moguće pristupiti korištenjem CKAN API akcija

Kreiraj https://plymouth.thedata.place/hr/api/3/action/datastore_create
Ažuriraj / Umetni https://plymouth.thedata.place/hr/api/3/action/datastore_upsert
Upit https://plymouth.thedata.place/hr/api/3/action/datastore_search

Primjer upita (prvih pet rezultata)

https://plymouth.thedata.place/hr/api/3/action/datastore_search?resource_id=cf4f1f9c-7ed6-4aa1-ade8-ab5b2e1fef64&limit=5

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

https://plymouth.thedata.place/hr/api/3/action/datastore_search?resource_id=cf4f1f9c-7ed6-4aa1-ade8-ab5b2e1fef64&q=jones

Jednostavan ajax (JSONP) upit prema API-ju podataka korištenjem jQuery.

          var data = {
            resource_id: 'cf4f1f9c-7ed6-4aa1-ade8-ab5b2e1fef64', // the resource id
            limit: 5, // get 5 results
            q: 'jones' // query for 'jones'
          };
          $.ajax({
            url: 'https://plymouth.thedata.place/hr/api/3/action/datastore_search',
            data: data,
            dataType: 'jsonp',
            success: function(data) {
              alert('Total results found: ' + data.result.total)
            }
          });
        import urllib.request
        url = 'https://plymouth.thedata.place/hr/api/3/action/datastore_search?resource_id=cf4f1f9c-7ed6-4aa1-ade8-ab5b2e1fef64&limit=5&q=title:jones'  
        fileobj = urllib.request.urlopen(url)
        print(fileobj.read())