1,554
edits
(move section) |
|||
Line 124: | Line 124: | ||
=== Three ways to fetch a specific record based on iDigBio UUID === | === Three ways to fetch a specific record based on iDigBio UUID === | ||
The following three examples intend to illustrate the various methods for looking up a unique record in iDigBio | The following three examples intend to illustrate the various methods for looking up a unique record in iDigBio. Each record that is added to iDigBio is assigned a Globally Unique Identifier (GUID) of the UUID type. | ||
The data returned by the Elasticsearch interface may differ from the raw API record, especially with regards to field names, since the Elasticsearch data has been normalized and indexed for consumption by the search portal. | The data returned by the Elasticsearch interface may differ from the raw API record, especially with regards to field names, since the Elasticsearch data has been normalized and indexed for consumption by the search portal. | ||
Line 138: | Line 138: | ||
==== Use the API ==== | ==== Use the API ==== | ||
A complete record that was provided to iDigBio is stored in the API and can be retrieved by referencing the iDigBio UUID ("idigbio:uuid") at the appropriate endpoint. | |||
We issue an HTTP "GET" request to the <code>/v1/records/{UUID}</code> endpoint with curl: | |||
<pre> | <pre> | ||
Line 209: | Line 209: | ||
The normalized and indexed record that is stored in Elasticsearch can be retrieved by referencing the iDigBio UUID ("uuid") as the term provided to the query string parameter. | The normalized and indexed record that is stored in Elasticsearch can be retrieved by referencing the iDigBio UUID ("uuid") as the term provided to the query string parameter. | ||
Note that under normal circumstances if one has the iDigBio UUID then there is no reason to use Elasticsearch; the full record is available at the API endpoint. | |||
The list of available terms in the iDigBio index is available at [[IDigBio_API#Elasticsearch_-_Records]]. | The list of available terms in the iDigBio index is available at [[IDigBio_API#Elasticsearch_-_Records]]. | ||
Line 214: | Line 216: | ||
===== Use the Elasticsearch URI Search ===== | ===== Use the Elasticsearch URI Search ===== | ||
The following command sends the query as an HTTP | The following command sends the query as an HTTP "GET" request: | ||
<pre> | <pre> | ||
Line 362: | Line 364: | ||
A JSON query document can be specified on the command-line. Again we are searching for the iDigBio UUID in the "uuid" term. | A JSON query document can be specified on the command-line. Again we are searching for the iDigBio UUID in the "uuid" term. | ||
The following command sends the query as an HTTP | The following command sends the query as an HTTP "POST" request: | ||
<pre> | <pre> | ||
Line 374: | Line 376: | ||
</pre> | </pre> | ||
and | and gives the following result: | ||
<pre> | <pre> | ||
Line 517: | Line 519: | ||
</pre> | </pre> | ||
Alternatively, the JSON-formatted query body | Alternatively, the JSON-formatted query body may be sourced from a file. In this example, the file is named uuid.json and contains the iDigBio UUID in the "uuid" term as before: | ||
<pre> | <pre> |
edits