O2A INDEX API
The O2A INDEX API provide access to harvested metadata content collected from different sources.
The service provides full-text search capabilities based on Elasticsearch query string syntax.
Search Requests
The original search endpoint supports GET and POST requests. Use POST requests for fine-grained or more complex customized search requests.
GET /index/rest/serch/{index}?
POST /index/rest/searchThe search response is provided as JSON document. Next to the default index response format following formats are supported:
dataciterenders the payload according to the Datacite schemaoriginalrenders the original source payload in the response
Examples
Following examples search or filter for water temperature in the harvest and harvest-extern indices.
- all content: https://o2a-data.de/index/rest/search/harvest,harvest-extern?hits=10&q=water temperature
- content provided by PANGAEA: https://o2a-data.de/index/rest/search/harvest,harvest-extern?hits=10&q=water temperature&qf=organisations.provider.abbreviation/PANGAEA
- content provided by PANGAEA with Datacite formatted payload: https://o2a-data.de/index/rest/search/harvest,harvest-extern?hits=10&q=water temperature&qf=organisations.provider.abbreviation/PANGAEA&format=datacite
- content provided by PANGAEA with original payload: https://o2a-data.de/index/rest/search/harvest,harvest-extern?hits=10&q=water temperature&qf=organisations.provider.abbreviation/PANGAEA&format=original
- organizations providing such content: https://o2a-data.de/index/rest/search/harvest,harvest-extern?hits=0&q=water temperature&f=organisations.provider.abbreviation
- providers and datacenters over all content: https://o2a-data.de/index/rest/search/harvest,harvest-extern?hits=0&f=organisations.provider.abbreviation:1000,organisations.datacenter.abbreviation:1000
Parameters
The following table describes GET query parameters and JSON encoded field names for POST requests with examples. The query parameter index or the field indices are mandatory.
| GET | POST | Description | Example GET | Example POST |
|---|---|---|---|---|
| q | query | Full-text query | climate AND arctic | "climate AND arctic" |
| qf | queryFacets | Query facets (filter map by field and values) | expedition/PS101 | |
| qg | queryGeometries | Query geometries (GeoJSON filter map by field) | geometry/{"type":"Point","coordinates":[8.57,53.53]} | { "geometry": [{"type":"Point","coordinates":[8.57,53.53]}] } |
| f | facets | Fields to aggregate values (field or field:N, where N is the number of results) | expeditions:20 | ["expeditions:20"] |
| offset | offset | Start offset for pagination | 0 | 0 |
| hits | hits | Number of records to return | 10 | 10 |
| sort | sorts | Sort field(s), use :desc for descending | date:desc | ["date:desc"] |
| exclude | excludes | Fields excluded from response payload | events | ["events"] |
| include | includes | Fields explicitly included in response payload | title | ["title"] |
| scroll | scroll | Enable / continue scrolling for large result sets (true or the scroll value from last response) | true | true |
| operator | operator | Boolean operator for terms (AND or OR) | AND | "AND" |
| format | format | Response metadata format (unset, datacite, original) | datacite | "datacite" |
| index | indices | List of index names to search in (required) | harvest,harvest-extern | ["harvest", "harvest-extern"] |
A maximum of 10000 records will be returned. To get more search results, set the scroll parameter to true initially. The response will return the next scroll token that can be used for subsequent requests.
GET Scroll Example
bash
curl -X GET 'https://o2a-data.de/index/rest/search/harvest,harvest-extern?q=climate%20AND%20arctic&qf=expeditions/PS101&f=expeditions:20&offset=0&hits=10&sort=date&exclude=events&include=title&scroll=true&operator=AND&format=datacite'POST Scroll Example
bash
curl -X POST "https://o2a-data.de/index/rest/search" \
-H "Content-Type: application/json" \
-d '{
"query": "climate AND arctic",
"queryFacets": { "expeditions": ["PS101", "PS102"] },
"queryGeometries": { "geometry": [{"type":"Point","coordinates":[8.57,53.53]}] },
"facets": ["expeditions:20"],
"offset": 0,
"hits": 10,
"sorts": ["date"],
"excludes": ["events"],
"includes": ["title"],
"scroll": "true",
"operator": "AND",
"format": "datacite",
"indices": ["harvest", "harvest-extern"]
}'Original Source
During harvesting the original metadata source document is stored.
To get the original source, use the original format in search requests or download the original source directly per uniqueId. Since this operation is IO expensive, use it carefully.
Example
Download the original harvested source document with uniqueId oai:pangaea.de:doi:10.1594/PANGAEA.266536.
bash
curl https://o2a-data.de/index/rest/source/oai:pangaea.de:doi:10.1594/PANGAEA.266536Adapters
The index service provides experimental adapters for standardized interfaces.
OGC Records API Endpoints
Following GET endpoints are provided. The path parameter collectionId defines the index to query. Use _all to search in all indices. The path parameter itemId targets to the uniqueId of a document.
- https://o2a-data.de/index/rest/ogc/records
- https://o2a-data.de/index/rest/ogc/records/conformance
- https://o2a-data.de/index/rest/ogc/records/collections
- https://o2a-data.de/index/rest/ogc/records/collections/{collectionId}
- https://o2a-data.de/index/rest/ogc/records/collections/{collectionId}/items
- https://o2a-data.de/index/rest/ogc/records/collections/{collectionId}/items/{itemId}
These query parameters are available
qFull-text querylimitNumber of records to returnoffsetStarting offset for paginationfResponse metadata format, e.g.jsonorgeojson