IDigBio API v1 Examples: Difference between revisions

changing to search example →‎Curculionidae Image Example
(changing to search example →‎Curculionidae Image Example)
Line 971: Line 971:
''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.''


=== Curculionidae Image Example ===
=== Curculionidae Search Example ===


Let us say we have already located the specimen record for a particular Curculionidae specimen (a family of weevils). The speciment record for our particular example is identified by the following iDigBio UUID:
Let us say we are looking for an image of a particular Curculionidae specimen (a family of weevils).  
 
If we already know the iDigBio UUID of the specimen we can simply use the /media endpoint for the record:


<code>
<code>
"idigbio:uuid" : "354210ae-4aa3-49d2-8a66-78a86b019c7b"
http://api.idigbio.org/v1/records/354210ae-4aa3-49d2-8a66-78a86b019c7b/media?quality=webview</code>
</code>
</code>


To retrieve a specimen record from v1 of the API with the above iDigBio UUID, we issue a GET HTTP request to the following endpoint:
But how did we find the proper iDigBio UUID for this specimen record in the first place?


<code>
http://api.idigbio.org/v1/records/354210ae-4aa3-49d2-8a66-78a86b019c7b
</code>


and receive the following JSON document from the API (in this case, formatted for readability):
and receive the following JSON document from the API (in this case, formatted for readability):
Line 1,040: Line 1,039:
}
}
</pre>
</pre>
This specimen record contains a link to a media record:
<code>
http://api.idigbio.org/v1/mediarecords/59141135-813a-4db1-a527-009ae6d17101
</code>
We can then display the image as a thumbnail by using the "media" endpoint and adding the "quality" parameter.
<code>
http://api.idigbio.org/v1/mediarecords/59141135-813a-4db1-a527-009ae6d17101/media?quality=webview
</code>
which when visited in a browser will lead (via one or more HTTP redirects) to an image.  Note that the final image URL should not be considered permanent as image locations can change over time (but the mediarecord ID will remain the same).


=== Advanced Elasticsearch Examples ===
=== Advanced Elasticsearch Examples ===
1,554

edits