Pristup resursima podataka kroz web API uz široku podršku upita. Dodatne informacije u osnovnom CKAN API-ju podataka i dokumentaciji u DataStore-u .
API-ju podataka je moguće pristupiti korištenjem sljedećih CKAN API akcija.
Kreiraj | https://gdcatalognhic.nha.co.th/bs/api/3/action/datastore_create |
---|---|
Ažuriraj / Unesi | https://gdcatalognhic.nha.co.th/bs/api/3/action/datastore_upsert |
Upit | https://gdcatalognhic.nha.co.th/bs/api/3/action/datastore_search |
Jednostavan ajax (JSONP) upit prema API-ju podataka korištenjem jQuery.
var data = { resource_id: '8124fa51-7186-4b63-aee4-d58102fba951', // the resource id limit: 5, // get 5 results q: 'jones' // query for 'jones' }; $.ajax({ url: 'https://gdcatalognhic.nha.co.th/bs/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/bs/api/3/action/datastore_search?limit=5&resource_id=8124fa51-7186-4b63-aee4-d58102fba951&q=title:jones' fileobj = urllib.urlopen(url) print fileobj.read()