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: '3d28ec0e-f33d-4f8e-89a7-22617b5eaf18', // 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=3d28ec0e-f33d-4f8e-89a7-22617b5eaf18&q=title:jones' fileobj = urllib.urlopen(url) print fileobj.read()