ה- API של נתוני CKAN

גשו למשאב מידע דרך API מקוון עם תמיכה בשאילתות מורכבות. Further information in the main CKAN Data API and DataStore documentation.

נקודות קצה »

ה-API של המידע יכול להתקבל באמצעות הפעולות הבאות של API פעולות של CKAN.

צרו http://datos.techo.org/he/api/3/action/datastore_create
הוסיפו/עדכנו http://datos.techo.org/he/api/3/action/datastore_upsert
שאילתה http://datos.techo.org/he/api/3/action/datastore_search
שאילתה (באמצעות SQL) http://datos.techo.org/he/api/3/action/datastore_search_sql
ביצוע שאילתה »
דוגמה לשאילתה (5 התוצאות הראשונות)

http://datos.techo.org/he/api/3/action/datastore_search?resource_id=f2c9a8cf-ce19-45a1-9ede-604ba376a1e6&limit=5

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

http://datos.techo.org/he/api/3/action/datastore_search?q=jones&resource_id=f2c9a8cf-ce19-45a1-9ede-604ba376a1e6

דוגמה לשאילתה (באמצעות מידע SQL)

http://datos.techo.org/he/api/3/action/datastore_search_sql?sql=SELECT * from "f2c9a8cf-ce19-45a1-9ede-604ba376a1e6" WHERE title LIKE 'jones'

דוגמה: ג'אווה סקריפט »

בקשת ajax (JSONP) ל-API מידע באמצעות jQuery.

        var data = {
          resource_id: 'f2c9a8cf-ce19-45a1-9ede-604ba376a1e6', // the resource id
          limit: 5, // get 5 results
          q: 'jones' // query for 'jones'
        };
        $.ajax({
          url: 'http://datos.techo.org/he/api/3/action/datastore_search',
          data: data,
          dataType: 'jsonp',
          success: function(data) {
            alert('Total results found: ' + data.result.total)
          }
        });
לדוגמא: פייתון »
      import urllib
      url = 'http://datos.techo.org/he/api/3/action/datastore_search?resource_id=f2c9a8cf-ce19-45a1-9ede-604ba376a1e6&limit=5&q=title:jones'  
      fileobj = urllib.urlopen(url)
      print fileobj.read()