ה־API של CKAN לנתונים

גישה למשאב מידע דרך API מקוון עם תמיכה בשאילתות מורכבות. יש מידע נוסף בתיעוד של API הנתונים של CKAN ושל ה־DataStore (מאגר נתונים).

אפשר לגשת ל־API של הנתונים דרך הפעולות הבאות של API הפעולות של CKAN.

יצירה https://plymouth.thedata.place/he/api/3/action/datastore_create
הוספה / עדכון https://plymouth.thedata.place/he/api/3/action/datastore_upsert
שאילתה https://plymouth.thedata.place/he/api/3/action/datastore_search

דוגמה לשאילתה (5 התוצאות הראשונות)

https://plymouth.thedata.place/he/api/3/action/datastore_search?resource_id=57e2507e-7342-4cb1-b284-014caaa463a2&limit=5

דוגמה לשאילתה (תוצאות שכוללות ‚jones’)

https://plymouth.thedata.place/he/api/3/action/datastore_search?resource_id=57e2507e-7342-4cb1-b284-014caaa463a2&q=jones

בקשת ajax‏ (JSONP) פשוטה ל־API של הנתונים באמצעות jQuery.

          var data = {
            resource_id: '57e2507e-7342-4cb1-b284-014caaa463a2', // the resource id
            limit: 5, // get 5 results
            q: 'jones' // query for 'jones'
          };
          $.ajax({
            url: 'https://plymouth.thedata.place/he/api/3/action/datastore_search',
            data: data,
            dataType: 'jsonp',
            success: function(data) {
              alert('Total results found: ' + data.result.total)
            }
          });
        import urllib.request
        url = 'https://plymouth.thedata.place/he/api/3/action/datastore_search?resource_id=57e2507e-7342-4cb1-b284-014caaa463a2&limit=5&q=title:jones'  
        fileobj = urllib.request.urlopen(url)
        print(fileobj.read())