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

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

נקודות קצה »

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

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

https://datos.cnbs.gob.hn/he/api/3/action/datastore_search?resource_id=27a0b7c4-4bf6-43d9-85a1-3f09c9af6358&limit=5

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

https://datos.cnbs.gob.hn/he/api/3/action/datastore_search?resource_id=27a0b7c4-4bf6-43d9-85a1-3f09c9af6358&q=jones

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

https://datos.cnbs.gob.hn/he/api/3/action/datastore_search_sql?sql=SELECT * from "27a0b7c4-4bf6-43d9-85a1-3f09c9af6358" WHERE title LIKE 'jones'

דוגמה: JavaScript »

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

        var data = {
          resource_id: '27a0b7c4-4bf6-43d9-85a1-3f09c9af6358', // the resource id
          limit: 5, // get 5 results
          q: 'jones' // query for 'jones'
        };
        $.ajax({
          url: 'https://datos.cnbs.gob.hn/he/api/3/action/datastore_search',
          data: data,
          dataType: 'jsonp',
          success: function(data) {
            alert('Total results found: ' + data.result.total)
          }
        });
דוגמה: Python »
      import urllib
      url = 'https://datos.cnbs.gob.hn/he/api/3/action/datastore_search?resource_id=27a0b7c4-4bf6-43d9-85a1-3f09c9af6358&limit=5&q=title:jones'  
      fileobj = urllib.urlopen(url)
      print fileobj.read()