Zugriff auf Ressourcen per Web-Schnittstelle mit umfangreichen Suchmöglichkeiten. Further information in the main CKAN Data API and DataStore documentation.
Die Daten-Schnittstelle (Data-API) kann über folgende Schnittstellenbefehle der CKAN Action API erreicht werden.
Erstellen | https://opendata.kp.gov.pk/de/api/3/action/datastore_create |
---|---|
Aktualisieren / Einfügen | https://opendata.kp.gov.pk/de/api/3/action/datastore_upsert |
Abfrage | https://opendata.kp.gov.pk/de/api/3/action/datastore_search |
Abfrage (mit SQL) | https://opendata.kp.gov.pk/de/api/3/action/datastore_search_sql |
https://opendata.kp.gov.pk/de/api/3/action/datastore_search?resource_id=e4420256-0f3c-4816-898a-75916db2c74e&limit=5
https://opendata.kp.gov.pk/de/api/3/action/datastore_search?q=jones&resource_id=e4420256-0f3c-4816-898a-75916db2c74e
https://opendata.kp.gov.pk/de/api/3/action/datastore_search_sql?sql=SELECT * from "e4420256-0f3c-4816-898a-75916db2c74e" WHERE title LIKE 'jones'
Eine einfache AJAX (JSONP) Abfrage des Data API mit jQuery.
var data = { resource_id: 'e4420256-0f3c-4816-898a-75916db2c74e', // the resource id limit: 5, // get 5 results q: 'jones' // query for 'jones' }; $.ajax({ url: 'https://opendata.kp.gov.pk/de/api/3/action/datastore_search', data: data, dataType: 'jsonp', success: function(data) { alert('Total results found: ' + data.result.total) } });
import urllib url = 'https://opendata.kp.gov.pk/de/api/3/action/datastore_search?resource_id=e4420256-0f3c-4816-898a-75916db2c74e&limit=5&q=title:jones' fileobj = urllib.urlopen(url) print fileobj.read()