Prístup k zdrojom dát prostredníctvom webového API s podporou dopytovania. Further information in the main CKAN Data API and DataStore documentation.
Prístup k dátovému API prostredníctvom nasledujúcich CKAN akcií API
Vytvoriť | https://gdcatalognhic.nha.co.th/sk/api/3/action/datastore_create |
---|---|
Aktualizovať / Vložiť | https://gdcatalognhic.nha.co.th/sk/api/3/action/datastore_upsert |
Dopyt | https://gdcatalognhic.nha.co.th/sk/api/3/action/datastore_search |
Jednoduchá ajaxová (JSONP) požiadavka pre dátovú API využívajúcu jQuery
var data = { resource_id: 'f01d74b5-ac03-4cb3-ad6f-0528ab6bc929', // the resource id limit: 5, // get 5 results q: 'jones' // query for 'jones' }; $.ajax({ url: 'https://gdcatalognhic.nha.co.th/sk/api/3/action/datastore_search', data: data, dataType: 'jsonp', success: function(data) { alert('Total results found: ' + data.result.total) } });
import urllib url = 'https://gdcatalognhic.nha.co.th/sk/api/3/action/datastore_search?limit=5&resource_id=f01d74b5-ac03-4cb3-ad6f-0528ab6bc929&q=title:jones' fileobj = urllib.urlopen(url) print fileobj.read()