Toegang tot bron data via een web API met krachtige query ondersteuning. Further information in the main CKAN Data API and DataStore documentation.
De Data API kan worden benaderd via de volgende acties van de CKAN action API.
Creëer | https://catalog.citydata.in.th/nl/api/3/action/datastore_create |
---|---|
Updaten / toevoegen | https://catalog.citydata.in.th/nl/api/3/action/datastore_upsert |
Query | https://catalog.citydata.in.th/nl/api/3/action/datastore_search |
Query (via SQL) | https://catalog.citydata.in.th/nl/api/3/action/datastore_search_sql |
https://catalog.citydata.in.th/nl/api/3/action/datastore_search?resource_id=4b7be4e0-0d84-4d81-924a-4a9deb92bb9a&limit=5
https://catalog.citydata.in.th/nl/api/3/action/datastore_search?q=jones&resource_id=4b7be4e0-0d84-4d81-924a-4a9deb92bb9a
https://catalog.citydata.in.th/nl/api/3/action/datastore_search_sql?sql=SELECT * from "4b7be4e0-0d84-4d81-924a-4a9deb92bb9a" WHERE title LIKE 'jones'
Een eenvoudige ajax (JSONP) aanvraag naar de data API met jQuery.
var data = { resource_id: '4b7be4e0-0d84-4d81-924a-4a9deb92bb9a', // the resource id limit: 5, // get 5 results q: 'jones' // query for 'jones' }; $.ajax({ url: 'https://catalog.citydata.in.th/nl/api/3/action/datastore_search', data: data, dataType: 'jsonp', success: function(data) { alert('Total results found: ' + data.result.total) } });
import urllib url = 'https://catalog.citydata.in.th/nl/api/3/action/datastore_search?resource_id=4b7be4e0-0d84-4d81-924a-4a9deb92bb9a&limit=5&q=title:jones' fileobj = urllib.urlopen(url) print fileobj.read()