CKAN data-API

Få tilgang til ressursdata via et web-API med sterk query-støtte. Further information in the main CKAN Data API and DataStore documentation.

Data-APIet kan nås via disse handlingene til CKANs action-API.

Opprett https://opendata.upplandsvasby.se/no/api/3/action/datastore_create
Oppdater/legg til https://opendata.upplandsvasby.se/no/api/3/action/datastore_upsert
Spørring https://opendata.upplandsvasby.se/no/api/3/action/datastore_search

Eksempel på spørring (første fem resultater)

https://opendata.upplandsvasby.se/no/api/3/action/datastore_search?resource_id=833c56d8-88c8-4821-9efc-86be6adf9cd4&limit=5

Eksempel på spørring (resultater inneholder 'jones')

https://opendata.upplandsvasby.se/no/api/3/action/datastore_search?resource_id=833c56d8-88c8-4821-9efc-86be6adf9cd4&q=jones

En enkelt ajax (JSONP) forespørsel til data-APIet ved bruk av jQuery

          var data = {
            resource_id: '833c56d8-88c8-4821-9efc-86be6adf9cd4', // the resource id
            limit: 5, // get 5 results
            q: 'jones' // query for 'jones'
          };
          $.ajax({
            url: 'https://opendata.upplandsvasby.se/no/api/3/action/datastore_search',
            data: data,
            dataType: 'jsonp',
            success: function(data) {
              alert('Total results found: ' + data.result.total)
            }
          });
        import urllib.request
        url = 'https://opendata.upplandsvasby.se/no/api/3/action/datastore_search?resource_id=833c56d8-88c8-4821-9efc-86be6adf9cd4&limit=5&q=title:jones'  
        fileobj = urllib.request.urlopen(url)
        print(fileobj.read())