Deposits

API change history

The deposits API allows to retrieve all deposits (documents and data) published by EFSA. The API users can access from a unique standard interface all the EFSA depositions stored in different repositories. The API returns the metadata either in Dublin Core standard (dc) or in EFSA specific format (Business Information Entity - bie).

search

This API allows to retrieve metadata of EFSA published documents. Metadata can be expressed in Dublin Core (dc) or EFSA Business Information Entity (bie). In order to retrieve metadata it is possible to execute a query on the following list of fields:

BIE: title, type, abstract, content_doi, keywords, affiliation, publication_author, published_date, correspondence, language, publisher, publication_issn, journal_number, panel_members, question_number, adoption_date, acknowledgment, disclaimer_text, volume_number, issue_number

Dublin Core: title, type, description, identifier, subject, rightsHolder, creator, issued, language, contributor, rights, relation, publisher, isRequiredBy, format

To retrieve metadata expressed in Dublin Core insert metadata_format=dc. To retrieve metadata expressed in EFSA Business Information Entity insert metadata_format=bie. If metadata_format is omitted or contains a value different from the ones listed above, the response will not return metadata.

Below you can find some example of query search. For a complete guide on query syntax refers to https://docs.microsoft.com/en-us/rest/api/searchservice/search-documents

Search metadata of documents published after 31 january 2018:

Dublin Core { "metadata_format": "dc", "top": "35", "skip": "0", "count": "true", "filter" : "issued gt 2018-01-31T00:00:00Z" }

Business Information Entity { "metadata_format": "bie", "top": "35", "skip": "0", "count": "true", "filter" : "published_date gt 2018-01-31T00:00:00Z" }

Search metadata by document identifier:

Dublin Core { "metadata_format": "dc",
"search": "identifier: \"10.5281/zenodo.1255952 \"", "top": "10", "skip": "0", "count": "true", "queryType": "full" }

Business Information Entity { "metadata_format": "bie",
"search": "content_doi:\"10.5281/zenodo.1255952\"", "top": "10", "skip": "0", "count": "true", "queryType": "full" }

Serach metadata of documents whose keywords and abstract contain the word bees or Apidae or honey:

Dublin Core { "metadata_format":"dc", "search": "subject:(bees || Apidae || honey) AND description: (bees || Apidae || honey) ", "queryType": "full", "count":"true", "top":"10", "skip":"0" }

Business Information Entity { "metadata_format":"bie", "search": "keywords:(bees || Apidae || honey) AND abstract: (bees || Apidae || honey) ", "queryType": "full", "count":"true", "top":"10", "skip":"0" }

Please note: the GET method allows to execute the same actions of the above described POST method.

Furthermore please note that metadata currently returned by the API is retrieved form two different repositories: Zenodo and Wiley. By default when a search is executed it takes data from both sources. If you need to restrict the search to only one repository please use the "metadata_source" metadata. Accepted values for this metadata are 'zenodo' or 'wiley'. Filtering by source requires as well to switch to the Lucene full query syntax via setting "queryType": "full". Below an example of query that restricts the search on Wiley repository

{ "metadata_format": "bie", "search": "keywords:welfare AND metadata_source:wiley", "count": "true", "top": "3", "skip": "0", "queryType": "full", "select":"keywords, content_doi" }

Try it

Request

Request URL

Request headers

  • (optional)
    string
    Media type of the body sent to the API.
  • string
    Subscription key which provides access to this API. Found in your Profile.

Request body

 { 
   "metadata_format":"dc",
   "search":"*",
   "top":"3",
   "skip":"0"
 }
{
  "example": " { \n   \"metadata_format\":\"dc\",\n   \"search\":\"*\",\n   \"top\":\"3\",\n   \"skip\":\"0\"\n }"
}

Responses

200 OK

Representations

{
  "response": {
    "value": [
      {
        "id": "13",
        "title": "Report Of The Scientific Committee Of The Spanish Agency For Food Safety And Nutrition (Aesan) On The Role Of Nutrition In Autoimmune Diseases.",
        "type": "Report",
        "description": "<p>The immune system is a network of cells, tissues, and organs that work together to defend the body <br>\nagainst attacks by “foreign” invaders. If pathogens survive the body’s front-line defenses, they still <br>\nhave to find a way to escape a series of general defenses of the innate immune system, which are ready to attack without regard for specific antigen markers. These include patrolling phagocytes, natural killer T cells, and complement. Pathogens that cross the general barriers then confront specific weapons <br>\nof the adaptive immune system tailored just for them. (...) These tissues form the gut-associated lymphoid tissue and include the tonsils, adenoids, Peyer´s patches, lymphoid aggregates and appendix. (...) The result is called an <br>\nautoimmune disease. (...) The profound effect of diet on the immune system is well-known since many years ago. (...) In this regard, it has been established that: i) it is not yet possible to conclude whether caloric restriction improves the pathology of human autoimmune diseases; ii) polyunsaturated fatty acids seem to reduce autoimmune disease severity, however, its mechanisms of action is still unclear; iii) some dietary peptides and proteins are capable of inducing autoimmune diseases, such as celiac disease, type 1 diabetes and rheumatoid arthritis; iv) human studies investigating the effects of antioxidant vitamins, administered alone or together, have shown not quite significant benefits on clinical symptoms; v) vitamin D deficiency is associated with a higher risk of type 1 diabetes and multiple sclerosis. Deficiency <br>\nsupplementation ameliorates this predisposition and vi) the few randomised, double-blind placebocontrolled <br>\ntrials, with high doses of several probiotics strains, carried on patients with inflammatory bowel diseases, show a decrease in clinical inflammatory score, in medically treated patients. (...)</p>",
        "identifier": "10.5281/zenodo.808030",
        "subject": [
          "autoimmune diseases",
          "Opinion",
          "Spain",
          "nutrients",
          "nutrition",
          "immune system",
          "probiotics"
        ],
        "rightsholder": [
          "Spanish Agency for Consumer Affairs, Food Safety and Nutrition"
        ],
        "creator": [
          "Spanish Agency for Consumer Affairs, Food Safety and Nutrition"
        ],
        "issued": "2011-04-01T00:00:00Z",
        "publisher": "Zenodo",
        "rights": [
          "Creative Commons Attribution 4.0",
          "Open Access"
        ],
        "relation": [
          "10.5281/zenodo.808029"
        ],
        "source": "http://doi.org/10.5281/zenodo.808030"
      },
      {
        "id": "14",
        "title": "Report Of The Scientific Committee Of Aesan In Relation To The Microbiological Risks Associated With The Consumption Of Fruits Obtained From Fragaria And Rubus Spp.",
        "type": "Report",
        "description": "<p>The consumption and as a result, the world production of fruits obtained from Fragaria spp. (such as <br>\nstrawberries) or Rubus spp. (such as raspberries or blackberries) has significantly increased worldwide <br>\nin recent years. Spain is one of the largest producers of fruits from these plants, such as strawberries <br>\nand raspberries. It is therefore of great relevance to know the microbiological risks associated with the <br>\nconsumption of these fruits, as well as the possible preventive measures to avoid the occurrence of <br>\noutbreaks derived from berries intake. <br>\nTo the present, these fruits have caused outbreaks mainly due to the presence of viral agents <br>\n(especially norovirus and hepatitis A virus) and parasites (especially Cyclospora cayetanensis), whereas <br>\nin the case of bacterial pathogens it has only been documented one outbreak caused by Escherichia <br>\ncoli O157: H7. <br>\nGiven the heterogeneity of potentially contaminating pathogens in these products, and the fact that <br>\nthey are usually eaten raw or minimally processed, it is difficult to establish disinfection protocols to <br>\nensure their safety. For this reason, in order to maintain food security it is essential to maximize the <br>\ngood hygienic practices in cultivation and harvesting, especially in fruits cultivated at ground level. <br>\nIt is also necessary to maintain a standardized and internationally accepted traceability system that <br>\nallows a rapid identification of the causing agent when an outbreak caused by the consumption of <br>\nthese fruits occurs.</p>",
        "identifier": "10.5281/zenodo.807935",
        "subject": [
          "foodborne diseases",
          "Opinion",
          "disinfection",
          "foodborne",
          "blackberries",
          "raspberries",
          "Spain",
          "microbiological risks",
          "outbreak",
          "strawberries",
          "outbreaks",
          "prevention"
        ],
        "rightsholder": [
          "Spanish Agency for Consumer Affairs, Food Safety and Nutrition"
        ],
        "creator": [
          "Spanish Agency for Consumer Affairs, Food Safety and Nutrition"
        ],
        "issued": "2013-02-01T00:00:00Z",
        "publisher": "Zenodo",
        "rights": [
          "Creative Commons Attribution 4.0",
          "Open Access"
        ],
        "relation": [
          "10.5281/zenodo.807934"
        ],
        "source": "http://doi.org/10.5281/zenodo.807935"
      },
      {
        "id": "17",
        "title": "Report Of The Scientific Committe Of Aesan About The Safety Criteria Applicable To The Content Of Domoic Acid In Scallops (Pecten Maximus) Harvesting",
        "type": "Report",
        "description": "<p>Commission Decision 2002/226/EC of 15 March 2002 (UE, 2002) allows a restricted harvesting regime  <br>\nof scallops with a domoic acid concentration in the whole body higher than 20 mg/kg. For this, two consecutive analyses of samples, taken between one and seven days maximum, must show that  <br>\nthe domoic acid concentration in the whole mollusk is lower than 250 mg/kg and that the DA concentration  <br>\nin the parts intended for human consumption (muscle + gonad), which have to be analyzed separately, is lower than 4.6 mg/kg.  <br>\nThe Autonomous Community of Galicia proposes to include the analysis of muscle + gonad (the  <br>\nedible part) as a basis for the checks of the harvesting in production areas, while maintaining the  <br>\nsame reference level of 4.6 mg/kg.  <br>\nThis Committee considers that the level of 4.6 mg/kg for the edible part (muscle + gonad) is safe  <br>\nand can be used as a criterion in the checks of the harvesting of scallop.</p>",
        "identifier": "10.5281/zenodo.807099",
        "subject": [
          "Opinion",
          "Spain",
          "amnesic",
          "amendment of the Decision 2002/226/EC",
          "shellfish",
          "King scallop",
          "poisoning",
          "Pecten spp.",
          "legal limit",
          "Domoic acid"
        ],
        "rightsholder": [
          "Spanish Agency for Consumer Affairs, Food Safety and Nutrition"
        ],
        "creator": [
          "Spanish Agency for Consumer Affairs, Food Safety and Nutrition"
        ],
        "issued": "2009-10-01T00:00:00Z",
        "publisher": "Zenodo",
        "rights": [
          "Creative Commons Attribution 4.0",
          "Open Access"
        ],
        "relation": [
          "10.5281/zenodo.807098"
        ],
        "source": "http://doi.org/10.5281/zenodo.807099"
      }
    ]
  }
}

400 Bad Request

"response": { "error": { "code": "", "message": "Illegal arguments in query request: titles is not a searchable field." } }

"response": { "error": { "code": "", "message": "Invalid expression: Could not find a property named 'published_dates' on type 'search.document'.\r\nParameter name: $filter" } }

"response": { "error": { "code": "", "message": "Invalid expression: Syntax error at position 16 in 'published_date : 2018-01-31T00:00:00Z'.\r\nParameter name: $filter" } }

"response":{ "error": { "code": "", "message": "The request is invalid. Invalid JSON." } }

Representations

401 Unauthorized

{ "statusCode": 401, "message": "Access denied due to missing subscription key. Make sure to include subscription key when making requests to an API." }

Representations

500 Internal Server Error

{ "statusCode": 500, "message": "Internal server error", "activityId": "41abc763-72f1-490a-8746-4e45e5c0217e" }

Representations

Code samples

@ECHO OFF

curl -v -X POST "https://openapi.efsa.europa.eu/deposits/"
-H "Content-Type: application/json"
-H "Ocp-Apim-Subscription-Key: {subscription key}"

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");

            var uri = "https://openapi.efsa.europa.eu/deposits/?" + queryString;

            HttpResponseMessage response;

            // Request body
            byte[] byteData = Encoding.UTF8.GetBytes("{body}");

            using (var content = new ByteArrayContent(byteData))
            {
               content.Headers.ContentType = new MediaTypeHeaderValue("< your content type, i.e. application/json >");
               response = await client.PostAsync(uri, content);
            }

        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://openapi.efsa.europa.eu/deposits/");


            URI uri = builder.build();
            HttpPost request = new HttpPost(uri);
            request.setHeader("Content-Type", "application/json");
            request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
        };
      
        $.ajax({
            url: "https://openapi.efsa.europa.eu/deposits/?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("Content-Type","application/json");
                xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
            },
            type: "POST",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://openapi.efsa.europa.eu/deposits/";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"POST"];
    // Request headers
    [_request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://openapi.efsa.europa.eu/deposits/');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'Content-Type' => 'application/json',
    'Ocp-Apim-Subscription-Key' => '{subscription key}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_POST);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'Content-Type': 'application/json',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.urlencode({
})

try:
    conn = httplib.HTTPSConnection('openapi.efsa.europa.eu')
    conn.request("POST", "/deposits/?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'Content-Type': 'application/json',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.parse.urlencode({
})

try:
    conn = http.client.HTTPSConnection('openapi.efsa.europa.eu')
    conn.request("POST", "/deposits/?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://openapi.efsa.europa.eu/deposits/')


request = Net::HTTP::Post.new(uri.request_uri)
# Request headers
request['Content-Type'] = 'application/json'
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body