1,554
edits
(change screenshot to "records" type →Display a thumbnail image for a mediarecord) |
|||
Line 915: | Line 915: | ||
;TO DO One more paging to help differentiate these multiples of 5. | ;TO DO One more paging to help differentiate these multiples of 5. | ||
=== Display a thumbnail image for a | === Display a thumbnail image for a specimen record === | ||
Let's say that we wish to display a thumbnail image for a particular | Let's say that we wish to display a thumbnail image for a particular specimen record. | ||
We can look at the full | We can look at the full record: | ||
<pre> | <pre> | ||
$ curl -s "http://api.idigbio.org/v1/ | $ curl -s "http://api.idigbio.org/v1/records/182c9260-0151-454a-a648-4d58ddf51bd8" | json_pp | ||
{ | { | ||
"idigbio:uuid" : " | "idigbio:uuid" : "182c9260-0151-454a-a648-4d58ddf51bd8", | ||
"idigbio:etag" : " | "idigbio:etag" : "bb5ee46e2730948c946c178e8da85dedee4bea80", | ||
"idigbio:links" : { | "idigbio:links" : { | ||
"mediarecord" : [ | |||
"http://api.idigbio.org/v1/mediarecords/00002091-4fb3-410a-9307-bd3e917dfcca" | |||
], | |||
"owner" : [ | "owner" : [ | ||
"872733a2-67a3-4c54-aa76-862735a5f334" | "872733a2-67a3-4c54-aa76-862735a5f334" | ||
], | ], | ||
"recordset" : [ | "recordset" : [ | ||
Line 940: | Line 940: | ||
"idigbio:createdBy" : "872733a2-67a3-4c54-aa76-862735a5f334", | "idigbio:createdBy" : "872733a2-67a3-4c54-aa76-862735a5f334", | ||
"idigbio:recordIds" : [ | "idigbio:recordIds" : [ | ||
"urn:uuid: | "urn:uuid:7d0d4400-7c6c-4bb4-b2ad-7b1f6e776755" | ||
], | ], | ||
"idigbio:dateModified" : "2014-05-03T14: | "idigbio:dateModified" : "2014-05-03T14:27:40.596Z", | ||
"idigbio:data" : { | "idigbio:data" : { | ||
" | "idigbio:recordId" : "urn:uuid:7d0d4400-7c6c-4bb4-b2ad-7b1f6e776755", | ||
" | "dwc:catalogNumber" : "CBS.038533", | ||
" | "dwc:specificEpithet" : "novae-angliae", | ||
"dwc:occurrenceID" : "272024", | "dwc:occurrenceID" : "272024", | ||
" | "dwc:year" : "0", | ||
" | "dwc:recordedBy" : "Hugh S. Clark", | ||
" | "dwc:scientificName" : "Symphyotrichum novae-angliae", | ||
" | "dwc:basisOfRecord" : "PreservedSpecimen", | ||
" | "dwc:family" : "Asteraceae", | ||
" | "symbiotaverbatimScientificName" : "Symphyotrichum novae-angliae", | ||
" | "dwc:collectionCode" : "CBS", | ||
" | "dcterms:modified" : "2012-03-14 00:00:00", | ||
"dwc:decimalLongitude" : "-72.6834", | |||
"dwc:country" : "USA", | |||
"dcterms:references" : "http://portal.neherbaria.org/portal/collections/individual/index.php?occid=272024", | |||
"dwc:municipality" : "Hartford", | |||
"dwc:scientificNameAuthorship" : "(L.) G.L. Nesom", | |||
"dwc:month" : "0", | |||
"dwc:rights" : "http://hdl.handle.net/10079/8931zqj", | |||
"dwc:geodeticDatum" : "WGS84", | |||
"dwc:rightsHolder" : "Peabody Museum of Natural History, Yale University", | |||
"dwc:stateProvince" : "Connecticut", | |||
"dwc:genus" : "Symphyotrichum", | |||
"dwc:coordinateUncertaintyInMeters" : "5419", | |||
"dwc:decimalLatitude" : "41.766", | |||
"dwc:accessRights" : "http://hdl.handle.net/10079/8931zqj", | |||
"dwc:institutionCode" : "YPM", | |||
"dwc:county" : "Hartford County" | |||
} | } | ||
} | } | ||
</pre> | </pre> | ||
At this point we have a couple of options to get to the thumbnail. The easiest is to use the /media endpoint for this record's iDigBio UUID and add the "quality" parameter with "thumbnail" as the value: | |||
http://api.idigbio.org/v1/ | http://api.idigbio.org/v1/records/182c9260-0151-454a-a648-4d58ddf51bd8/media?quality=thumbnail | ||
which results in a number of HTTP Redirects to the target thumbnail image, illustrated here with the Chrome Developer Tools visible: | which results in a number of HTTP Redirects to the target thumbnail image, illustrated here with the Chrome Developer Tools visible: | ||
[[File: | [[File:Screenshot_firefox_webdevtools_thumbnail_specimen_182c9260-0151-454a-a648-4d58ddf51bd8.png]] | ||
''Note that the final image URL should not be considered stable or permanent. Images can be moved around to various storage platforms. The Mediarecord has a UUID that will remain contstant but the containing data, including the image location, may be updated over time.'' | ''Note that the final image URL should not be considered stable or permanent. Images can be moved around to various storage platforms. The Mediarecord has a UUID that will remain contstant but the containing data, including the image location, may be updated over time.'' | ||
The /media endpoint of a specimen record is kind of shortcut to avoid having to walk through the relationship to a mediarecord and then to an image file. | |||
Alternatively, if we actually wanted to look at media metadata, we could use the link to the mediarecord in the <code>"idigbio:links"</code> section: | |||
<pre> | |||
"idigbio:links" : { | |||
"mediarecord" : [ | |||
"http://api.idigbio.org/v1/mediarecords/00002091-4fb3-410a-9307-bd3e917dfcca" | |||
], | |||
</pre> | |||
which also has a /media endpoint that can lead to the same thumbnail image. | |||
http://api.idigbio.org/v1/mediarecords/00002091-4fb3-410a-9307-bd3e917dfcca/media?quality=thumbnail | |||
=== Advanced Elasticsearch Examples === | === Advanced Elasticsearch Examples === |
edits