Developers’ corner

The EU Open Data Portal aims to encourage the use of EU datasets for building third-party applications. To help achieve this, two programming interfaces are proposed to developers.

Share your app

REST API access

One way to access the EU Open Data Portal is to use the REST API. All of the portal core functionalities are available through the API, which encompasses all you can do with the web interface and even more. The information retrieved can thus be used by external code that calls the portal API.

For programmatic use, the API is available at the following URL: http://data.europa.eu/euodp/data/api/

The EU Open Data Portal relies on an application of CKAN, on whose website you can find documentation about the API.

The message format for both the body of the requests and the answers is JSON (specified in RFC 4627). Below are some examples of what you can do using the REST API in your application.

Due to particularities in the infrastructure of the Publication Office, all API requests that by definition would be available via the GET method of the HTTP protocol, must be instead made via the POST method.

Tools for using the REST API

Generic HTTP clients and libraries

curl is a generic http command-line tool that can be used to query the API. There are possibilities to force curl using POST requests for example by adding the data option -'d' even with an empty list. It will be used in the sample queries below.

Some extensions exist for most of the popular browsers that will make it possible to build queries to the API within the browser, for instance Postman for Google Chrome or RESTClient for Mozilla Firefox.

Most programming languages can be used to query the API as long as there is a compatible HTTP connection component such as Jersey for Java.

Dedicated tools

Some specialised tools have been developed and can be used to facilitate use of the REST API. All of these clients are available on Github and can be forked to develop custom solutions in the mentioned programming languages.

Sample queries

Get a list of the datasets in JSON

curl http://data.europa.eu/euodp/data/api/action/package_list -d'{}'

Get a list of the tags in JSON

curl http://data.europa.eu/euodp/data/api/action/tag_list -d'{}'

Get a description of a particular dataset in JSON

curl http://data.europa.eu/euodp/data/api/action/package_show -d'{"id": "dgt-translation-memory"}'

Search for datasets or resources matching a query

curl http://data.europa.eu/euodp/data/api/action/package_search -d'{"q": "forest"}'

The SPARQL endpoint

Another way to access the EU Open Data Portal is the machine readable SPARQL endpoint which allows queries on the RDF descriptions of datasets.

As shown on the 'Linked data' page, a graphical user interface is provided to enter your SPARQL queries.

For programmatic use, a machine readable endpoint is available at the following URL: http://data.europa.eu/euodp/sparqlep

You can find specifications of SPARQL on the W3C web site: http://www.w3.org/TR/rdf-sparql-query/. The models used to describe datasets catalogued on the EU Open Data Portal are described on the ‘Linked data’ page under ‘Metadata vocabulary’.

Tools and libraries

To build applications able to perform queries on the endpoint of the EU Open Data Portal it is possible to use third party libraries and applications. See below for some examples of such solutions.

SPARQL Clients

  • Sesame client is a Windows SPARQL client featuring a graphical user interface.
  • Twinkle is a cross-platform Java application offering a user interface to perform SPARQL queries on remote endpoints.

Libraries

Organised by programming language, here are a few of the libraries that can be used to build applications using the data from the EU Open Data Portal.

  • Java
    • Jena is an Apache project. It is an open source Java framework for building Semantic Web and Linked Data applications.
    • OpenRDF Sesame offers a Java API to handle and query RDF data.
  • C
    • Redland is a set of C libraries providing RDF and SPARQL support.
  • Javascript
    • Hercules proposes a JavaScript library to query remote the SPARQL endpoint. It allows building rich web applications using information from the EU Open Data Portal.
  • PHP
    • EASYRDF is a PHP library to ease the use of SPARQL queries in your PHP application.
  • Python
    • RDFLib proposes a set of python libraries to incorporate RDF data into a python application.
/div>