Tilgå ressourcens data via et web-API med kraftfuld query-support. Further information in the main CKAN Data API and DataStore documentation.
Data-API'et kan tilgås via følgende actions fra CKAN action API'et.
Opret | https://ckan.hoda.jp/da_DK/api/3/action/datastore_create |
---|---|
Opdatér / indsæt | https://ckan.hoda.jp/da_DK/api/3/action/datastore_upsert |
Forespørg | https://ckan.hoda.jp/da_DK/api/3/action/datastore_search |
Forespørg (via SQL) | https://ckan.hoda.jp/da_DK/api/3/action/datastore_search_sql |
https://ckan.hoda.jp/da_DK/api/3/action/datastore_search?resource_id=62563b0c-1661-471f-8ac8-9dcec4beee4e&limit=5
https://ckan.hoda.jp/da_DK/api/3/action/datastore_search?resource_id=62563b0c-1661-471f-8ac8-9dcec4beee4e&q=jones
https://ckan.hoda.jp/da_DK/api/3/action/datastore_search_sql?sql=SELECT * from "62563b0c-1661-471f-8ac8-9dcec4beee4e" WHERE title LIKE 'jones'
En simpel ajax (JSONP)-forespørgsel til data API'et vha. jQuery.
var data = { resource_id: '62563b0c-1661-471f-8ac8-9dcec4beee4e', // the resource id limit: 5, // get 5 results q: 'jones' // query for 'jones' }; $.ajax({ url: 'https://ckan.hoda.jp/da_DK/api/3/action/datastore_search', data: data, dataType: 'jsonp', success: function(data) { alert('Total results found: ' + data.result.total) } });
import urllib url = 'https://ckan.hoda.jp/da_DK/api/3/action/datastore_search?resource_id=62563b0c-1661-471f-8ac8-9dcec4beee4e&limit=5&q=title:jones' fileobj = urllib.urlopen(url) print fileobj.read()