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.

Endpoints »

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

Opprett https://gdcatalognhic.nha.co.th/no/api/3/action/datastore_create
Oppdater/legg til https://gdcatalognhic.nha.co.th/no/api/3/action/datastore_upsert
Spørring https://gdcatalognhic.nha.co.th/no/api/3/action/datastore_search
Spør » (จำกัดผลลัพธ์ 10,000 เรคคอร์ด)
Eksempel på spørring (første fem resultater)

https://gdcatalognhic.nha.co.th/no/api/3/action/datastore_search?limit=5&resource_id=8e082b13-75a2-40a0-950f-7ce53543ba8b

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

https://gdcatalognhic.nha.co.th/no/api/3/action/datastore_search?q=jones&resource_id=8e082b13-75a2-40a0-950f-7ce53543ba8b

Eksempel: Javascript »

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

        var data = {
          resource_id: '8e082b13-75a2-40a0-950f-7ce53543ba8b', // the resource id
          limit: 5, // get 5 results
          q: 'jones' // query for 'jones'
        };
        $.ajax({
          url: 'https://gdcatalognhic.nha.co.th/no/api/3/action/datastore_search',
          data: data,
          dataType: 'jsonp',
          success: function(data) {
            alert('Total results found: ' + data.result.total)
          }
        });
Eksempel: Python »
      import urllib
      url = 'https://gdcatalognhic.nha.co.th/no/api/3/action/datastore_search?limit=5&resource_id=8e082b13-75a2-40a0-950f-7ce53543ba8b&q=title:jones'  
      fileobj = urllib.urlopen(url)
      print fileobj.read()