.. _metadata_xml_search_retrieve:
Search and Retrieve Metadata services
=====================================
.. index:: xml.search
Search metadata (xml.search)
----------------------------
The **xml.search** service can be used to retrieve metadata records from GeoNetwork.
Requires authentication: Optional
Request
```````
Search configuration parameters (all values are optional)
- **remote**: Search in local catalog or in a remote catalog. Values: off (default), on
- **extended**: Values: on, off (default)
- **timeout**: Timeout for request in seconds (default: 20)
- **hitsPerPage**: Results per page (default: 10)
- **similarity**: Lucene accuracy for searches (default 0.8)
- **sortBy**: Sorting criteria. Values: relevance (default), rating, popularity, changeDate, title
Search parameters (all values are optional):
- **eastBL, southBL, northBL, westBL**:
Bounding box to restrict the search
- **relation**: Bounding box criteria.
Values: equal, overlaps (default), encloses, fullyOutsideOf,
intersection, crosses, touches, within
- **any**: Text to search in a free text search
- **title**: Metadata title
- **abstract**: Metadata abstract
- **themeKey**: Metadata keywords. To search for several use a value like "Global" or "watersheds"
- **template**: Indicates if search for templates or not. Values: n (default), y
- **dynamic**: Map type. Values: off (default), on
- **download**: Map type. Values: off (default), on
- **digital**: Map type. Values: off (default), on
- **paper**: Map type. Values: off (default), on
- **group**: Filter metadata by group, if missing search in all groups
- **attrset**:
- **dateFrom**: Filter metadata created after specified date
- **dateTo**: Filter metadata created before specified date
- **category**: Metadata category. If not specified, search all categories
Request to search for all metadata example::
Url:
http://localhost:8080/geonetwork/srv/eng/xml.search
Mime-type:
application/xml
Post request:
Request with free text search example::
Url:
http://localhost:8080/geonetwork/srv/eng/xml.search
Mime-type:
application/xml
Post request:s
africa
Request with a geographic search example::
Url:
http://localhost:8080/geonetwork/srv/eng/xml.search
Mime-type:
application/xml
Post request:
africa74.9157429.4061138.4719860.50417overlapsrelevancegeo
Request to search using dates and keywords example::
Url:
http://localhost:8080/geonetwork/srv/eng/xml.search
Mime-type:
application/xml
Post request:
africa"Global" or "World"2000-02-03T12:47:002010-02-03T12:49:00
Response
````````
The response is the metadata record with additional
**geonet:info** section. The main fields are:
- **response**: Response container.
- **summary**: Attribute
**count** indicates the number of metadata records retrieved
- **keywords**: List of keywords
that are part of the metadata resultset. Each keyword
contains the value and the number of occurences in the
retrieved metadata records.
- **metadata**: Container for
each metadata record found. Each container has a
**geonet:info** element with the
following information:
- **id**: Metadata internal
identifier
- **uuid** : Metadata
Universally Unique Identifier (UUID)
- **schema**: Metadata
schema
- **createDate**: Metadata
creation date
- **changeDate**: Metadata last
modification date
- **source**: Source catalogue
the metadata
- **category**: Metadata
category (Can be multiple elements)
- **score**: Value indicating
the accuracy of search
Metadata search response example::
12bc179f91-11c1-4878-b9b4-2270abde98ebiso191392007-07-25T12:05:452007-11-06T12:10:47mapsinteractiveResources1.0115df54bf0-3a7d-44bf-9abf-84d772da8df1iso191392007-07-19T14:45:072007-11-06T12:13:00mapsdatasetsinteractiveResources0.9178859
.. index:: xml.metadata.get
Get metadata (xml.metadata.get)
-------------------------------
The **xml.metadata.get** service can be used to retrieve a metadata record stored in GeoNetwork.
Requires authentication: Optional
Request
```````
*One* of the following parameters:
- **uuid** : Metadata Universal Unique Identifier (UUID)
- **id**: Metadata internal identifier
Get metadata request example::
Url:
http://localhost:8080/geonetwork/srv/en/xml.metadata.get
Mime-type:
application/xml
Post request:
aa9bc613-8eef-4859-a9eb-4df35d8b21e4
Response
````````
Successful response (HTTP status code 200) is the XML metadata record with additional **geonet:info** section. The principal fields for **geonet:info** are:
- **schema**: Metadata schema
- **createDate**: Metadata creation date
- **changeDate**: Metadata last modification date
- **isTemplate**: Indicates if the metadata returned is a template
- **title**: Metadata title
- **source**: Source catalogue the metadata
- **uuid** : Metadata Universally Unique Identifier (UUID)
- **isHarvested**: Indicates if the metadata is harvested
- **popularity**: Indicates how often the record is retrieved
- **rating**: Average rating provided by users
- State of operation on metadata for the user: view, notify, download, dynamic, featured, edit
- **owner**: Indicates if the user that executed the service is the owner of metadata
- **ownername**: Metadata owner name
Get metadata response example::
aa9bc613-8eef-4859-a9eb-4df35d8b21e4
...
10iso191152005-08-23T17:58:182007-03-12T17:49:50naa9bc613-8eef-4859-a9eb-4df35d8b21e4n00truetruetruetruetruetruetrueadmin
Error response (HTTP 500 status code) is an XML document with the details of what
went wrong. An example of such a response is as follows::
Operation not allowedOperationNotAllowedEx
.....
See :ref:`exception_handling` for more details.
Errors
``````
- **Request must contain a UUID or an ID**, if a uuid or id parameter was not provided. Returns 500 HTTP code
- **Operation not allowed (error id:
operation-not-allowed)**, when the user is not allowed
to view the metadata record. Returns 500 HTTP code
.. index:: xml.user.metadata
Get user metadata (xml.user.metadata)
-------------------------------------
The **xml.user.metadata** service can be used to retrieve a metadata records according to the user profile of the authenticated user running the service:
- *Administrator* profile: return all metadata records
- *Reviewer* or *User Administrator* profile: return all metadata records with
groupOwner in the set of groups the user belongs to
- *Editor* profile: return all metadata records owned by the user
Requires authentication: Yes
Request
```````
- **sortBySelect** : (optional) parameter specifying sort order of metadata records returned.
Get metadata request example::
Url:
http://localhost:8080/geonetwork/srv/eng/xml.user.metadata
Mime-type:
application/xml
Post request:
Response
````````
Successful response is an XML document with a response container and the user metadata records as children of that container. Each child has a **geonet:info** element which gives GeoNetwork specific metadata about the metadata record. An example response (with some content removed for brevity) is as follows::
Error response is an XML document with error container and the details of the error. Example::
Service not allowed
....
engxml.user.metadata
See :ref:`exception_handling` for more details.
Errors
``````
- **Service not allowed (error id: service-not-allowed)**, user isn't allowed to
run this service. Returned 500 HTTP code.
- **Unauthorized user attempted to list editable metadata (error id:
operation-not-allowed)**, when the user is not allowed
to list metadata records. Returned 500 HTTP code
.. index:: rss.search
RSS Search: Search metadata and retrieve in RSS format (rss.search)
-------------------------------------------------------------------
The **rss.search** service can be used to
retrieve metadata records in RSS format, using regular search
parameters. This service can be configured in
**WEB-INF/config.xml** with the following parameters:
- **maxSummaryKeys**: Maximum number of RSS records to retrieve (default = 10)
Requires authentication: Optional. If not provided only public metadata records are retrieved
Request
```````
Parameters:
- **georss**: valid values are simple,
simplepoint and default. See also http://georss.org
- **simple**: Bounding box in georss
simple format
- **simplepoint**: Bounding box in
georss simplepoint format
- **default**: Bounding box in georss
GML format
- **eastBL, southBL, northBL, westBL**:
Bounding box to restrict the search****
- **relation**: Bounding box criteria.
Values: equal, overlaps (default), encloses, fullyOutsideOf,
intersection, crosses, touches, within
- **any**: Text to search in a free text search
- **title**: Metadata title
- **abstract**: Metadata abstract
- themeKey: Metadata keywords. To search for several use a value like "Global" or "watersheds"
- **dynamic**: Map type. Values: off (default), on
- **download**: Map type. Values: off (default), on
- **digital**: Map type. Values: off (default), on
- **paper**: Map type. Values: off (default), on
- **group**: Filter metadata by group, if missing search in all groups
- **attrset**:
- **dateFrom**: Filter metadata created after specified date
- **dateTo**: Filter metadata created before specified date
- **category**: Metadata category. If not specified, search all categories
RSS search request example::
Url:
http://localhost:8080/geonetwork/srv/en/rss.search
Mime-type:
application/xml
Post request:
simplepointafrica74.9157429.4061138.4719860.50417overlapsrelevancegeo
Response
````````
The principal fields of the response are:
- **channel**: This is the container for
the RSS response
- **title**: RSS channel title
- **description**: RSS channel description
- **item**: Metadata RSS item (one item for each metadata
retrieved)
- **title**: Metadata title
- **link**: Link to show metadata page. Additional link
elements (with rel="alternate") to OGC WXS services,
shapefile/images files, Google KML, etc. can be returned
depending on metadata
- **description**: Metadata description
- **pubDate**: Metadata publication date
- **media**: Metadata thumbnails
- **georss:point**: Bounding box in georss simplepoint
format
RSS search response example::
Mimetype:
application/rss+xml
Response:
GeoNetwork opensource portal to spatial data and information
http://localhost:8080/geonetwork
GeoNetwork opensource provides Internet access to interactive maps, satellite imagery and related spatial databases ... enAll rights reserved. Your generic copyright statement Geographic metadata catalogGeoNetwork opensource30Hydrological Basins in Africa (Sample record, please remove!)
http://localhost:8080/geonetwork?uuid=5df54bf0-3a7d-44bf-9abf-84d772da8df1
Geographic metadata catalog06 Nov 2007 12:13:00 ESThttp://localhost:8080/geonetwork?uuid=5df54bf0-3a7d-44bf-9abf-84d772da8df1Major hydrological basins and their sub-basins ...16.9 1.8
.. index:: rss.latest
RSS latest: Get latest updated metadata (rss.latest)
----------------------------------------------------
The **rss.latest** service can be used to retrieve the most recently modified metadata records in RSS format. This service can be configured in **WEB-INF/config.xml** file with the following parameters:
- **maxItems**: Maximum number of RSS records to retrieve (default = 20)
- **timeBetweenUpdates**: Minimum time (in seconds) between queries for latest updated metadata. If a request is received less than timeBetweenUpdates seconds after the last request, it will receive the same response.
Requires authentication: Optional. If not provided only public metadata records are retrieved
Request
```````
Parameters:
- **georss**: valid values are simple, simplepoint and default. See also http://georss.org
- **simple**: Bounding box in georss simple format
- **simplepoint**: Bounding box in georss simplepoint format
- **default**: Bounding box in georss GML format
RSS latest request example::
Url:
http://localhost:8080/geonetwork/srv/en/rss.latest
Mime-type:
application/xml
Post request:
default1
Response
````````
The following are the principal fields of the response:
- **channel**: This is the container for the RSS response
- **title**: RSS channel title
- **description**: RSS channel description
- **item**: Metadata RSS item (one item for each metadata
retrieved)
- **title**: Metadata title
- **link**: Link to show metadata page. Additional link
elements (with rel="alternate") to OGC WXS services,
shapefile/images files, Google KML, etc. can be returned
depending on metadata
- **description**: Metadata description
- **pubDate**: Metadata publication date
- **media**: Metadata thumbnails
- **georss:where**: Bounding box with the metadata
extent
RSS latest response example::
Mimetype:
application/rss+xml
Response:
GeoNetwork opensource portal to spatial data and information
http://localhost:8080/geonetwork
GeoNetwork opensource provides Internet access to interactive maps,
satellite imagery and related spatial databases ... enAll rights reserved. Your generic copyright statement Geographic metadata catalogGeoNetwork opensource30Hydrological Basins in Africa (Sample record, please remove!)
http://localhost:8080/geonetwork?uuid=5df54bf0-3a7d-44bf-9abf-84d772da8df1
Geographic metadata catalog06 Nov 2007 12:13:00 ESThttp://localhost:8080/geonetwork?uuid=5df54bf0-3a7d-44bf-9abf-84d772da8df1Major hydrological basins and their sub-basins ...-34.6 -17.338.2 51.1