Access to European Union open data
EUROPAEU Open Data PortalSample_REST_requests
Menu
Overview Knowledge center Projects Sandbox

Sample REST requests

Introduction

The following examples will briefly show you how to list datasets, search for datasets and show datasets details using EU ODP API.

The usage of our API is not limited to these examples. More details can be found on the API description: https://app.swaggerhub.com/apis/EU-Open-Data-Portal/eu-open_data_portal/

List datasets

The following examples show how to list datasets published on EU ODP.

List some datasets

This example shows how to list a limited number of datasets using the POST http method.

Request

Example showing the first 100 datasets

POST https://data.europa.eu/euodp/data/apiodp/package_list

Content-Type: application/json

 

{

   "limit" : 100,

   "offset" : 1

}

 

Parameter

Meaning

limit

Number of datasets returned by the query.

offset

Page number.

In our example with a limit of 100 datasets per query:

offset = 1 → datasets 1 to 100

offset = 2 → datasets 101 to 200

etc.

Response

{

...

  "result": [

    "0026aa70-cc6d-4f6f-8c2f-554a2f9b17f2",

    "00a87831-3a64-4a08-a681-3929aeca1876",

    "01009127-5ddf-4f69-8a6b-30e6218f17bb",

    "014be465-c941-4ad0-9817-b4de72e19773", ...

 

  ]

}

The response returns an array of datasets identifiers.

List all datasets

This example shows how to list all published datasets using the GET http method.

Request

Example showing all datasets

GET https://data.europa.eu/euodp/data/apiodp/package_list

Response

{

...

  "result": [

    "0026aa70-cc6d-4f6f-8c2f-554a2f9b17f2",

    "00a87831-3a64-4a08-a681-3929aeca1876",

    "01009127-5ddf-4f69-8a6b-30e6218f17bb",

    "014be465-c941-4ad0-9817-b4de72e19773", ...

 

  ]

}

The response returns an array of datasets identifiers.

Search for datasets

The following example shows how to search for datasets published on EU ODP containing a word in their title or description.

Request

This example shows how to search for the word "translation" and return up to 10 results.

Example showing 10 datasets related to "translation"

POST https://data.europa.eu/euodp/data/apiodp/package_search

Content-Type: application/json

 

{

   "q":"translation",

   "rows":"10"

}

 

Parameter

Meaning

q

Solr query - Search criteria

rows

Number of matching rows to return

More search parameters are described in the API specifications.

Response

{

...

  "result": {

     "count": 111,

     "sort": "score desc, metadata_modified desc",

     "facets": {},

     "results": [

         {

           "catalog_record": { ... },

           "rdf": "...",

           "capacity": "public",

           "dataset": {

              ...

           }

         },

         {

           "catalog_record": { ... },

           "rdf": "...",

           ...

         },

         ...

         ],

     "search_facets": {}

   }

}

Main elements returned in the response:

Key

Meaning

count

Number of elements found with the search parameters. This value can be higher than the number of rows requested, but only the number (maximum) of rows mentioned in the request will be returned.

sort

Parameters used for sorting results

results

Array with results

rdf

RDF description of the dataset (escaped to be embedded in JSON)

dataset

JSON representation of the dataset (structure is a transposition of DCAT-AP-OP RDF)

More details on the structure can be found in the API description in OpenAPI format (https://app.swaggerhub.com/apis/EU-Open-Data-Portal/eu-open_data_portal/).

Show a dataset

The following example shows how to show datasets details based on its unique identifier.

Request

This example returns in a machine readable format (JSON and RDF) the dataset DGT-Translation Memory published on EU ODP: https://data.europa.eu/euodp/data/dataset/dgt-translation-memory

POST https://data.europa.eu/euodp/data/apiodp/package_show

Content-Type: application/json

 

{

   "id":"dgt-translation-memory"

}

 

Parameter

Meaning

id

Unique identifier of the dataset

Response

{

...

  "result": {

      ...

      "rdf": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n ..."

      "dataset": {

          ...

          "uri": "https://data.europa.eu/88u/dataset/dgt-translation-memory",

 

          "distribution_dcat": [ ... ]

          ...

      }

      ...

  }

}

where

Field

Meaning

rdf

RDF description of the dataset (escaped to be embedded in JSON)

dataset

JSON representation of the dataset (structure is a transposition of DCAT-AP-OP RDF)

uri

URI of the dataset. Last part of the URI is the unique identifier of the dataset in EU ODP

distribution_dcat

Contains the links to the resources of the dataset

More details on the structure can be found in the API description in OpenAPI format.

Get the RDF description of a dataset

This is not really a call of the API, but an internal feature to get the RDF description of the dataset without having to use JSON.

When viewing a dataset in your web browser, just add ".rdf" in the URL and the RDF description can be downloaded.

For example:

Request

GET https://data.europa.eu/euodp/data/dataset/<identifier>.rdf

Response

XML/RDF file of the dataset.

<?xml version="1.0" encoding="UTF-8"?>

<rdf:RDF

   xmlns:adms="http://www.w3.org/ns/adms#"

   xmlns:dcat="http://www.w3.org/ns/dcat#"

   xmlns:dcatapop="https://data.europa.eu/88u/ontology/dcatapop#"

   xmlns:dcterms="http://purl.org/dc/terms/"

   xmlns:foaf="http://xmlns.com/foaf/0.1/"

   xmlns:owl="http://www.w3.org/2002/07/owl#"

   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

   xmlns:schema="http://schema.org/"

   xmlns:vcard="http://www.w3.org/2006/vcard/ns#"

>

  <rdf:Description rdf:about="https://data.europa.eu/88u/dataset/dgt-translation-memory">

    <dcat:distribution rdf:resource="https://data.europa.eu/88u/distribution/ce0b51c7-389f-4fc5-9233-3a166c67b6ab"/>

    <dcterms:title xml:lang="cs">Překladová paměť DGT</dcterms:title>

    <dcterms:description xml:lang="de">DGT-TM ist ein Übersetzungsspeicher mit ausgangssprachlichen Segmenten und deren Humanübersetzungen in 24 Sprachen. Er umfasst den gemeinschaftlichen Besitzstand (Acquis communautaire), also alle von der EU verabschiedeten Rechtsvorschriften (wie Verträge, Verordnungen und Richtlinien). Da jedes Land, das der EU beitritt, zur Übernahme des gesamten Besitzstands verpflichtet ist, wurde der Acquis in 24 Amtssprachen übersetzt. Für die 23. EU-Amtssprache Irisch ist jedoch keine vollständige Übersetzung des Acquis vorgesehen, weswegen DGT-TM nur wenige Datensätze auf Irisch enthält. Mit der Version von 2014 wurden Übersetzungen für die 24. Amtssprache Kroatisch hinzugefügt.</dcterms:description>

    <dcat:distribution rdf:resource="https://data.europa.eu/88u/distribution/5af5a8dd-d48b-4ba8-ba87-b45e5b43be7a"/>

    <dcterms:language rdf:resource="http://publications.europa.eu/resource/authority/language/FIN"/>

    <dcterms:language rdf:resource="http://publications.europa.eu/resource/authority/language/SWE"/>

    <dcat:distribution rdf:resource="https://data.europa.eu/88u/distribution/f7302533-37ad-419c-8585-09c284282f2d"/>

    <dcat:distribution rdf:resource="https://data.europa.eu/88u/distribution/7ef2c214-59b6-4502-956a-96a11d1a3c10"/>

    <dcterms:title xml:lang="el">Μεταφραστική μνήμη DGT</dcterms:title>

    <dcterms:title xml:lang="mt">Memorja tat-Traduzzjoni tad-DĠT</dcterms:title>

    <dcterms:description xml:lang="it">DGT-TM è una memoria di traduzione (di frasi e della loro traduzione realizzata manualmente) in 24 lingue. Contiene i segmenti dell’acquis comunitario, il corpus della legislazione europea, che comprende tutti i trattati, i regolamenti e le direttive adottate dall’Unione europea (UE). Dal momento che ogni nuovo paese che aderisce all’UE è tenuto ad accettare l’intero acquis comunitario, il corpus legislativo è stato tradotto nelle 24 lingue ufficiali. L’acquis non viene tradotto regolarmente per la 23a lingua ufficiale dell’UE, l’irlandese. Per questo motivo DGT-TM include solo pochi dati in irlandese. Dalla versione 2014 DGT-TM include anche le traduzioni per la 24a lingua ufficiale, il croato.</dcterms:description>

...

  </rdf:Description>

</rdf:RDF>