Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

All metadata from Europeana's APIs are provided as CC0, meaning you can reuse that metadata as you wish without any restrictions. Some of that metadata may link to content from Europeana's partners, like the content linked in the edm:IsShownBy and edm:Object fields. These objects can be used in accordance with the Rights Statement mentioned in the object metadata, in the europeana:rights/edm:rights field. Always check these fields before using the objects linked in Europeana's metadata! 

How can I get around Same Origin Policy / CORS issues?

A client application running on a web browser is typically prohibited from calling methods of an endpoint that is being served under a domain outside its own because of the same origin policy. To get around this restriction, we support CORS for all the APIs that we offer. For APIs such as the Record API and Search API, we still offer support for the outdated JSONP mechanism. Given that this mechanism has been superseded by CORS, we may stop supporting it in future versions of these APIs so we strongly recommend all users to shift from JSONP to CORS.

Cross-Origin Resource Sharing (CORS)

The Cross-Origin Resource Sharing (CORS) is a transparent mechanism using HTTP headers for client applications to call APIs served from a domain outside the one they are being served. To enable CORS, it is only necessary to supply the Origin HTTP header at every request with the domain where your application is running. After handling the request, the API will respond back with a set of headers that will tell the browser to lift the restrictions.

JSON with padding (JSONP)

JSONP (JSON with padding) is an older mechanism for getting around the same origin policy enforced by browsers. Unlike CORS, it is limited to GET request and works by supplying a client side (JavaScript) callback function that will be called with the respective response.

"Under the same origin policy, a web page served from server1.example.com cannot normally connect to or communicate with a server other than server1.example.com. An exception is the HTML script element. Exploiting the open policy for script elements, some pages use them to retrieve JavaScript code that operates on dynamically generated JSON-formatted data from other origins. This usage pattern is known as JSONP. Requests for JSONP retrieve not JSON, but arbitrary JavaScript code. They are evaluated by the JavaScript interpreter, not parsed by a JSON parser." (Wikipedia: JSONP)

A callback can be added to any JSON-based call by appending &callback=callbackname to the call, where the callbackname should be an existing JavaScript function existing on the client side. The API returns JSONP response, like this one:

Expand
titleexample JSON callback

https://api.europeana.eu/record/v2/[RECORD_ID].json?wskey=YOUR_KEY&callback=processEuropeanaSearch

Which returns

Code Block
processEuropeanaSearch({
  "apikey":"xxxxx",
  "action":"record.json",
  "success":true,
  "statsDuration":22,
  "requestNumber":8,
  "object": {
    "type":"TEXT",
    "title":["Bibliotheca Indica"],
    "about":"[record ID]",
    ...
  }
})

The JSON response is wrapped into your function, and the function use JSON as input parameter, and it immediatelly runs when it returns. In your client you have to define the callback function before you call the API. A client side example:

Code Block
<script>
function processEuropeanaSearch(json) {
  alert(json.object.title.join(', '));
}
</script>
<script src="https://api.europeana.eu/record/v2/0000/1111.json?wskey=xxxx&callback=processEuropeanaSearch"></script>

Can I add any cultural heritage data I have to Europeana's database by using the API? 

...