เข้าถึงทรัพยากรข้อมูลผ่าน API ของเว็บด้วยภาษาสอบถามที่ทรงพลัง. Further information in the main CKAN Data API and DataStore documentation.
Data API สามารถเข้าถึงได้ด้วยการเรียกใช้ CKAN action API
เรียกดูข้อมูล | https://1f8zn7l3f0.execute-api.ap-northeast-1.amazonaws.com/master/ckan/api/3/action/datastore_search |
---|
คำขอแบบ ajax (JSONP) พื้นฐาน เพื่อร้องขอข้อมูลผ่าน API โดยใช้ jQuery
var data = { resource_id: '10682cd7-41ed-4584-ad4e-146ff63d3d39', // the resource id limit: 5, // get 5 results q: 'jones' // query for 'jones' }; $.ajax({ url: 'https://1f8zn7l3f0.execute-api.ap-northeast-1.amazonaws.com/master/ckan/api/3/action/datastore_search', data: data, dataType: 'jsonp', success: function(data) { alert('Total results found: ' + data.result.total) } });
import urllib url = 'https://1f8zn7l3f0.execute-api.ap-northeast-1.amazonaws.com/ja/api/3/action/datastore_search?resource_id=10682cd7-41ed-4584-ad4e-146ff63d3d39&limit=5&q=title:jones' fileobj = urllib.urlopen(url) print fileobj.read()