DATA API
This Open Data Bizkaia page provides useful information for application developers, as well as for users with a more technical profile. In each of the following sections, basic aspects and methods for accessing datasets and resources through the CKAN API are defined.
- What is an API
- What is the identifier of a resource
- How to get the names of the fields of a resource
- How the API is used to make queries
- How to obtain the updated data of a resource
Further information in the main CKAN Data API and DataStore documentation.
-
API Endpoints
The Data API can be accessed via the following actions of the CKAN action API.
Create
https://www.opendatabizkaia.eus/es/api/3/action/datastore_createUpdate / Insert
https://www.opendatabizkaia.eus/es/api/3/action/datastore_upsertQuery
https://www.opendatabizkaia.eus/es/api/3/action/datastore_searchQuery (via SQL)
https://www.opendatabizkaia.eus/es/api/3/action/datastore_search_sql -
Query example
Example of a query (first five hits)
https://www.opendatabizkaia.eus/es/api/3/action/datastore_search?id=58f8c26e-996a-42e3-a49e-ef1e8e754ce6&limit=5Example query (results containing the value "TERRENO" in the field "HIGIEZIN MOTA_CAS/TIPO INMUEBLE_CAS")
https://www.opendatabizkaia.eus/es/api/3/action/datastore_search?id=58f8c26e-996a-42e3-a49e-ef1e8e754ce6&q={%22HIGIEZIN%20MOTA_CAS/TIPO%20INMUEBLE_CAS%22:%22%TERRENO%%22}Query example (via SQL statement)
https://www.opendatabizkaia.eus/es/api/3/action/datastore_search_sql?sql=SELECT%20*%20from%20%2258f8c26e-996a-42e3-a49e-ef1e8e754ce6%22%20WHERE%20%22KALEA/CALLE%22%20LIKE%20%27EL%VIVERO%%27 -
Example: Javascript
A simple ajax (JSONP) request to the data API using jQuery.
var data = { resource_id: ‘58f8c26e-996a-42e3-a49e-ef1e8e754ce6', // the resource id limit: 5, // get 5 results }; $.ajax({ url: '/datastore_search', data: data, dataType: 'jsonp', success: function(data) { alert('Total results found: ' + data.result.total) } }); -
Example: Python
import urllib.request url = 'https://www.opendatabizkaia.eus/es/api/3/action/datastore_search?id=58f8c26e-996a-42e3-a49e-ef1e8e754ce6&limit=5' fileobj = urllib.request.urlopen(url) print(fileobj.read())
