Europeana Annotations API (ALPHA)

The Annotations API is an extension to the Europeana REST API which allows you to create, retrieve and manage annotations on Europeana objects. Annotations are user-contributed or system-generated enhancements, additions or corrections to (or a selection of) metadata or media. We adopted the Web Annotation Data Model as a base model for the representation of annotations and as a format for exchanging annotations between client applications and the API, but also the Web Annotation Protocol as base HTTP protocol for the API.

Before start using this API, we recommend reading the Registering for an API key and reading the Terms of Use. If you want to get started with this API, go directly to the Getting Started section or try it out directly on the Console. If you want to get regular updates about the Europeana API, provide feedback and discuss it with other developers, we suggest to join the Europeana API discussion group at Google Groups.

Europeana Radio

Europeana Radio

Europeana Radio allows you to discover and listen to the music from Europeana's Music Collections. Pick your favourite station …

See more
Pundit

Pundit

Pundit is an open source semantic annotation tool developed allowing users to create structured data annotating the web.

See more
Europeana Connect Annotation Suite

Europeana Connect Annotation Suite

The EuropeanaConnect Annotation Suite - A tool that allows end-users to annotate digital images, maps, audio and video files.

See more

Roadmap and Changelog

The current version of the Annotations API is 0.2.7 (May 2017). It is currently available as a Public Alpha, which is the first public version released primarily to get feedback from you. Do note that this means that changes can be introduced which could break backwards compatibility. It also means that to use this API you need a separate API key than for the other Europeana APIs. To see the changes made for the current version and also all previous releases, see the API changelog in the project GitHub.

The plans for the upcoming versions leading up to the Public Beta, which is expected to be released in Q2 of 2018, are to:

  • Support for image (coordinates) annotations.
  • Allow Europeana REST API keys to be used for this API.
  • Connect MyEuropeana API to this API for user and client authentication and authorization.
  • Automated registration of providers for annotations.
  • Enhancements to semantic tagging with Support for more vocabularies.
  • TBD: Support for time-based annotations (audio).

Along with the planned features every new release will aim to improve existing features, enhance existing types of annotations and to incorporate feedback from developers and users.

Credits

This API was initially developed as part of the Europeana Sounds project. It's development has been carried out by the AIT Austrian Institute of Technology in cooperation with the Europeana Foundation.

Annotation Data Model

The Annotations API adopted the Web Annotation Data Model (or simply WA) as a base model for exchanging annotations between client applications and the API. It is a W3C recommendation that describes a model and format to share annotations across different platforms.

Please note that, even though we have adopted WA as underlying data model for this API, it is not expected that we support the full extent of the model. We thus advise to look at the EDM Annotations Profile which describes the basics of our implementation and, in particular, the section on Annotation Scenarios for a comprehensive list of the different kinds of annotations that we support.

Basics of the model

In WA, an annotation is essentially a reified relation between two or more resources, typically a body and a target, and conveys that the body reflects what is intended to be said about the target. A body can also be absent to describe situations where a target is simply bookmarked. A target can represent a resource or just a part of it that is being annotated.

Being reified as a class enables an annotation to be further described with a motivation which expresses the reason why the annotation was created but also some provenance information such as the user that created the annotation and the software application that was used, as well as the times when it was initially created and sent to the API.

Representation in JSON-LD

Annotation

FieldDatatypeDescription
@contextString (URL)The URL of the JSON-LD context. (always with value "http://www.w3.org/ns/anno.jsonld")
idString (URI)The identifier of the Annotation. It is automatically generated unless a local identifier is specified upon creation.
typeStringAlways has the values of "Annotation".
createdString (DateTime)The time at which the Annotation was created by the client application. It must be expressed in ISO8601 format and should have a timezone specified.
creatorObject (Agent)The agent responsible for creating the Annotation. This may be either a human or software agent.
generatedString (DateTime)The time at which the annotation was sent to the server.
generatorObject (Software)The agent responsible for generating the Annotation. Typically a client application used to create the annotation.
motivationStringExpresses the reason why the annotation was created. The value can be either "tagging" or "linking".
bodyString or Object (Semantic Resource or Textual Body)A body conveying what is intended to be said about the target. If the value is provided as a string, then it is interpreted as the URI and must only be used for the semantic tagging scenario. See the application scenarios section for more information.
bodyValueStringA string conveying the tag text. This field must only be used in combination with "tagging" as motivation and when the language of the tag is not known. Otherwise, it is recommended to use the body field as defined in the Application Scenarios section.
targetString or Array (String)The URL of the resource that is being annotated. An array of URLs may also be set (mostly used for the object linking).
viaStringThe URL of the annotation, if available in an external service.

Agent

An Agent can be either a Person or a Software. Typically the Person corresponds to the user that created the annotation while the Software reflects the client application that was used to create it. A Software can also create annotations if they result from an automatic process.

FieldDatatypeDescription
typeStringEither "Person" or "Software".
nameStringThe name of the agent. Either the name of the user that created the annotation, or the name of the client software that was used to create it.
homepageStringThe homepage of the user or client application, if available.

Semantic Resource

A Semantic Resource is used whenever an external resource needs to be referenced as the body of the annotation. It is mostly used for Semantic Tagging.

FieldDatatypeDescription
typeStringAlways "SpecificResource".
sourceString (URI)The URI of the resource being referred as body.
languageString (ISO639)The ISO639 language code corresponding to the language of the resource.

Optional and mandatory fields

FieldDatatypeDescription
@contextOMN/AM
idOMN/AM
typeOMN/AM
createdOMN/AM
creatorMMN/AM
generatedOMN/AM
generatorOMN/AM
motivationMMN/AM
bodyOM (either body or bodyValue)N/AM (either body or bodyValue)
bodyValueOM (either body or bodyValue)N/AM (either body or bodyValue)
targetMMN/AM

Example:

{
  "@context": “http://www.w3.org/ns/anno.jsonld”
  "id": "http://data.europeana.eu/annotations/1",
  "type": "Annotation",
  "created": "2015-03-10T14:08:07Z",
  "creator": {
    "type": "Person",
    "name": "John Smith"
  },
  "generated": "2015-04-01T09:00:00Z",
  "generator": {
      "type": "Software",
      "name": "HistoryPin",
      "homepage": "https://www.historypin.org/"
  },
  "motivation": "tagging",
  "bodyValue": "MyBeautifulTag",
  "target": "http://data.europeana.eu/item/92062/BibliographicResource_1000126189360"
}

Annotation Scenarios

The Annotations API supports different types of annotations. This page explains the types of annotations that are currently supported, providing examples on how to represent them in the API.

The examples used in this Section are shortened versions of the Annotation, see the complete version on Data Model.

Simple tags (without language)

A simple tag is a short textual description of a resource. This scenario only applies when the language of the tag is not know, otherwise see the scenario described in the next Section.

Examples:church
blue
black and white
Requirement:A maximum of 64 characters is allowed for a simple tag.
A tag cannot be a URL.
In the API:Set the "motivation" to "tagging" and set the tag within the "bodyValue" field.
Availability:Simple tags are available since version 0.2.1.

Example: tagging a Europeana item with the word "painting".

{
  "motivation": "tagging",
  "bodyValue": "painting",
  "target": "http://data.europeana.eu/item/92062/BibliographicResource_1000126189360"
}

Simple tags (with language)

A simple tag is a short textual description of a resource.

Examples:church
blue
black and white
Requirement:A maximum of 64 characters is allowed for a simple tag.
A tag cannot be a URL.
The language information must be specified.
In the API:Set the "motivation" to "tagging" and set the tag within the "body" field as a Textual Body.
Availability:Simple tags are available since version 0.2.1.

Example: tagging a Europeana item with the English word "painting"

{
  "motivation": "tagging",
  "body": {
    "type": "TextualBody",
    "value": "painting",
    "language": "en"
 },
  "target": "http://data.europeana.eu/item/92062/BibliographicResource_1000126189360"
}

Semantic tags

A semantic tag is a tag to a resource from a controlled vocabulary, making it machine-interpretable.

Example:This object in Europeana is somehow related to France (http://sws.geonames.org/2988507).
Requirement:Any URI is accepted as semantic resource. In the future, it will be limited to a controlled list of acceptable domains.
In the API:Set the "motivation" to "tagging" and set as body the URI for the semantic resource taken from a contolled vocabulary.
Availability:Semantic tags are available since version 0.2.1.

Example: tagging a Europeana item with the semantic resource for Paris from Geonames.

{
  "motivation": "tagging",
  "body": "http://sws.geonames.org/2988507",
  "target": "http://data.europeana.eu/item/09102/_UEDIN_214"
}

Object links

An object link is a relationship between two (Europeana) objects. This relationship can be any.

Example:This object in Europeana is (in some way) similar to this object.
Requirement:An object link can only be made between two Europeana objects.
In the API:Set the "motivation" to "linking" and set as target an array containing the URIs of both objects.
Availability:Object linking is available since version 0.2.1.

Example: linking two Europeana items together.

{
  "motivation": "linking",
  "target": [
      "http://data.europeana.eu/item/92062/BibliographicResource_1000126189360",
      "http://data.europeana.eu/item/92062/BibliographicResource_1000126189361"
  ]
}

Geo Tags

A geo-tag adds a geographical location to an item.

Example:This object in Europeana was located at latitude 52.081131 and longitude 4.324053. .
In the API:Set the "motivation" to "tagging" and include the "type", "lat" and "long" attributes in the body as per the example below.
Availability:Object linking is available since version 0.2.2.

Example: tagging a Europeana item with a geographical location.

{
  "motivation": "tagging",
  "body": {
    "@context": "http://www.europeana.eu/schemas/context/entity.jsonld",
    "type": "Place",
    "lat": "52.081131",
    "long": "4.324053"
  },
  "target": "http://data.europeana.eu/item/92034/GVNRC_NFA03_kop_6_3"
}

Getting started

What are annotations?

Annotations (in the Europeana context) are user-contributed or system-generated enhancements to (a selection of) metadata or media. The most well-known type of annotation is the "tag", a short textual depiction of something. Annotations allow for the creation of meaningful connections across Europeana and will also offer up new ways to explore or find the content you're looking for.

The Annotations API uses the Web Annotation Data Model as a guideline for how to represent and model annotations.

Access keys

While this API is in an Alpha state you will need to use a separate API key (other than for the main Europeana REST API) to start using it. You can use the following keys:

EnvironmentDetails
TestAPI key apidemo with user token tester1 (allows to create, update & remove annotations on behalf of a test user in the Annotations API test environment).
ProductionAPI key apidemo (allows to search and retrieve annotations in the Annotations API production (live) environment).
Creating annotations in the production (live) environment is currently limited to only selected partners, this will be opened up as part of the Beta release.

Request

Every Annotations API call is an HTTP request in a specified format that is sent to the Annotations API service. The API root URLs for the two environments are located at:

https://test-annotations.europeana.eu/annotation (test)
https://www.europeana.eu/api/annotations (production)

Response

This API only supports the JSON-LD format, which is the Linked Open Data version of JSON (with the same syntax as JSON). The request and response format does not need to be passed along to the API, if not provided it will fallback to the default. You can provide the format either via the URL (extension) or via the "Accept" header. To specify the request and response format you can either do:

/search.jsonld?wskey=xxxxx&query=*:*

Or:

Request header: "Accept: application/ld+json"
/search?wskey=xxxxx&query=*:*

Authentication

For reading requests (GET) you need to authenticate by passing along your API key as the wskey parameter. Example (replace YOUR_KEY with your API key):

/search?wskey=YOUR_KEY&query=*:*

For writing requests (POST/PUT/DELETE) on behalf of a user you need to pass along your API key as the wskey parameter along with a user token as the userToken parameter. Example (replace YOUR_KEY with your API key and YOUR_TOKEN with the user token):

/create?wskey=YOUR_KEY&userToken=YOUR_TOKEN&query=*:*

Error Codes

An error during processing of an API method is reported by (1) a relevant HTTP status code, (2) a value of the success field and (3) a meaningful error message in the error field.

The following HTTP status codes are returned:

HTTP Status CodeDescription
200The request was executed successfully.
401Authentication credentials were missing or authentication failed.
404The requested annotation was not found.
429The request could be served because the application has reached its usage limit.
500Internal Server Error. Something has gone wrong, which we will correct.

Annotation API Methods

Search for annotations.

GET /search

Request

ParameterDatatypeDescription
queryStringThe search term(s), this is mandatory.
profileStringThe search profile which determines the extent of information returned as search result. Currently, two options are supported: "minimal" which returns only the identifier of the annotation; and "standard" (the default) which returns the annotation as it was sent to the API.
qfStringQuery filter, to search on specific fields. The list of fields is presented below.
facetStringIncludes a field to be used as facet in the response (see below which fields can be used as facets). More than one field can be added if separated by a space.
pageSizeNumberThe number of records to return per page. For minimal profile, the maximum is 10.000 while for the standard profile is 100, with 10 as default for both profiles.
pageNumberThe page of the search results, defaults to 0 (first page).
sortStringIncludes a field to be used for sorting. One of: created, generated or modified.
sortOrderStringOrder of sorting, either "asc" (ascending) or "desc" (descending).

Search and Facet fields

The following table shows the fields that can be used for searching annotations and the ones that can be used for faceting:

FieldDatatypeUsed for FacettingDescription
motivationkeywordyesmotivation of the Annotation
anno_urikeywordcomplete identifier of an Annotation
anno_idkeywordlocal identifier of an Annotation (/<provider>/<identifier>)
generator_urikeywordyescomplete identifier of the generator
generator_namekeywordyesname of the generator
generateddatedate on which the Annotation was first provided to the API
creator_urikeywordyescomplete identifier of the creator
creator_namekeywordyesname of the user that created the annotation
createddatedate on which the Annotation was created by the annotation client application
modifieddatedate on which the Annotation was last modified
moderation_scoreintegeryessum of all reports made to an Annotation by other users
texttextsearches in all searchable text in an Annotation
body_valuetextyesvalue within the body of an Annotation, applies to e.g. simple tagging
body_urikeywordyescomplete identifier of the resource within the body of an Annotation, applies to e.g. semantic tagging
target_urikeywordyescomplete identified of the target(s) of an Annotation
target_record_idkeywordyeslocal identifier of a record when the target is a record (/collectionId/objectId)
link_resource_urikeywordyescomplete identifier of the resource being linked to (ie. through the relation property)
link_relationkeywordyesproperty being used to link two resources.

Response


{
  "@context": "http://www.w3.org/ns/anno.jsonld",
  "id": "http://annotations.europeana.eu/annotation/search?wskey=xxxxx&query=*:*&page=0&pageSize=10",
  "items": [
    "http://data.europeana.eu/annotation/base/1",
    "http://data.europeana.eu/annotation/base/2",
    [..]
  ],
  "next": "http://annotations.europeana.eu/annotation/search?wskey=xxxxx&query=*:*&page=1&pageSize=10",
  "partOf": {
     "id": "http://annotations.europeana.eu/annotation/search?wskey=xxxxx&query=*:*",
     "total": 135610
  },
  "total": 10,
  "type": "AnnotationPage"
}

Example: Search for recently added tags:

/search?wskey=xxxxx&profile=minimal&query=*:*&qf=motivation:tagging&sort=created&sortOrder=desc

Example: Search for tags for Europeana record ID /92028/532E53363138382D2F290A40B3CA26B3889A6907:

/search?wskey=xxxxx&profile=minimal&query=target_id:"/92028/532E53363138382D2F290A40B3CA26B3889A6907"

Example: Don't show annotations which are reported by two or more different users:

/search?wskey=xxxxx&profile=minimal&query=*:*&qf=moderation_score:[-1 TO *]

Note that providing *:* as a search query means you will get all annotations.

Create

The API has a generic method available for the creation of annotations. The creation method expects a body payload in the request with the full annotation. Alternatively you can provide this information as part of the body parameter.

POST http://annotations.europeana.eu/annotation/

Request

An example to create a simple tag:

POST  http://annotations.europeana.eu/annotation/?wskey=YOUR_KEY&userToken=YOUR_TOKEN HTTP/1.1
Accept: application/ld+json
Content-Type: application/ld+json
Content-Length: 999
{
  "motivation": "tagging",
  "bodyValue": "Trombone",
  "target": "http://data.europeana.eu/item/09102/_UEDIN_214"
}

Note that the motivation for a simple and a semantic tag is always "tagging", whereas the motivation for object linking scenarios is "linking".

Response

Response to the example request:


Content-Type: application/ld+json
ETag: "_87e52ce126126"
Link: <http://www.w3.org/ns/ldp#Resource>l; rel="type"
Allow: POST,GET,OPTIONS,HEAD
Vary: Accept
Content-Length: 999
{
  "@context": "http://www.w3.org/ns/anno.jsonld",
  "id": "http://data.europeana.eu/annotation/base/1",
  "type": "Annotation",
  "created": "2016-01-31T12:03:45Z",
  "creator": "http://data.europeana.eu/user/55376",
  "generated": "2016-01-31T12:04:00Z",
  "generator": "http://data.europeana.eu/provider/historypin",
  "bodyValue": "Trombone",
  "motivation": "tagging",
  "target": "http://data.europeana.eu/item/09102/_UEDIN_214"
}

For more examples and information on the data model for an annotation, see data model.

Read

Retrieve annotations by their identifier.

GET /{provider}/{identifier}

Response

HTTP/1.1 200 OK
Content-Type: application/ld+json
{
  "@context": "http://www.w3.org/ns/anno.jsonld",
  "id": "http://data.europeana.eu/annotation/base/1",
  "type": "Annotation",
  "created": "2016-01-31T12:03:45Z",
  "generated": "2016-01-31T12:04:00Z",
  "generator": "http://www.europeana.eu",
  "bodyValue": "Trombone",
  "motivation": "tagging",
  "target": "http://data.europeana.eu/item/09102/_UEDIN_214"
}

See data model for more information on the representation of an annotation.

Update

Update the contents of an annotation. For this you can send a PUT request to the ID of the annotation. You can only update the annotations you have created yourself.

PUT /base/1

Request

You can provide the same contents as for the creation of annotations. Note that you have to provide the full annotation body, you currently cannot update parts of the annotation.

PUT /base/1 HTTP/1.1
Accept: application/ld+json
{
  "bodyValue": "Trombone",
  "motivation": "tagging",
  "target": "http://data.europeana.eu/item/09102/_UEDIN_214"
}

Response

HTTP/1.1 200 OK
Content-Type: application/ld+json
{
  "@context": "http://www.w3.org/ns/anno.jsonld",
  "id": "http://data.europeana.eu/annotation/base/1",
  "type": "Annotation",
  "created": "2016-01-31T12:03:45Z",
  "generated": "2016-01-31T12:04:00Z",
  "generator": "http://www.europeana.eu",
  "bodyValue": "Trombone",
  "motivation": "tagging",
  "target": "http://data.europeana.eu/item/09102/_UEDIN_214"
}

Delete

Delete an annotation. For this you can send a DELETE http request using the ID of the annotation. You can only delete the annotations you have created yourself. Deletion means the annotation will not be available anymore for search, and only available for retrieval based on the ID of the annotation.

DELETE /base/1

Request

DELETE /collections/1 HTTP/1.1

Response

HTTP/1.1 204 NO CONTENT
Content-Length: 0

Console

Use the API Console to experiment with the API and build queries. The Request URL will display the call you need to make to the API.

The console below points to the production environment, to use the API console for the test environment click here.

top