IDigBio API v1 Examples: Difference between revisions

Jump to navigation Jump to search
add Curculionidae example
(add Curculionidae example)
Line 760: Line 760:


https://api.idigbio.org/v1/mediarecords/4c4c5008-5444-4348-85f5-34112b46169b/media?quality=webview
https://api.idigbio.org/v1/mediarecords/4c4c5008-5444-4348-85f5-34112b46169b/media?quality=webview
=== Curculionidae Image 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 GUID:
<code>
"idigbio:uuid" : "354210ae-4aa3-49d2-8a66-78a86b019c7b"
</code>
To retrieve a specimen record from v1 of the API with the above iDigBio GUID, we issue a GET HTTP request to the following endpoint:
<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):
<pre>
{
  "idigbio:uuid" : "354210ae-4aa3-49d2-8a66-78a86b019c7b",
  "idigbio:etag" : "02736fd7318eafed62a4a5ff35175a27fa63983e",
  "idigbio:links" : {
      "mediarecord" : [
        "http://api.idigbio.org/v1/mediarecords/59141135-813a-4db1-a527-009ae6d17101"
      ],
      "owner" : [
        "872733a2-67a3-4c54-aa76-862735a5f334"
      ],
      "recordset" : [
        "http://api.idigbio.org/v1/recordsets/69037495-438d-4dba-bf0f-4878073766f1"
      ]
  },
  "idigbio:version" : 2,
  "idigbio:createdBy" : "872733a2-67a3-4c54-aa76-862735a5f334",
  "idigbio:recordIds" : [
      "urn:uuid:b036a012-ba1e-41e0-a39a-76fc253640cf"
  ],
  "idigbio:dateModified" : "2014-04-22T07:33:16.129Z",
  "idigbio:data" : {
      "dwc:day" : "16",
      "dwc:identifiedBy" : "CPMAB",
      "idigbio:recordId" : "urn:uuid:b036a012-ba1e-41e0-a39a-76fc253640cf",
      "dwc:catalogNumber" : "NAUF4A0013309",
      "dwc:locality" : "Box Cyn. Santa Rita Mts.",
      "dwc:occurrenceID" : "1063507",
      "dwc:year" : "1967",
      "dwc:recordedBy" : "C.D. Johnson",
      "dwc:scientificName" : "Curculionidae",
      "dwc:basisOfRecord" : "PreservedSpecimen",
      "dwc:family" : "Curculionidae",
      "symbiotaverbatimScientificName" : "Curculionidae",
      "dwc:collectionCode" : "NAUF",
      "dcterms:modified" : "2013-12-20 13:00:36",
      "dwc:country" : "USA",
      "dcterms:references" : "http://symbiota4.acis.ufl.edu/scan/portal/collections/individual/index.php?occid=1063507",
      "dwc:eventDate" : "1967-08-16",
      "dwc:scientificNameAuthorship" : "Latreille, 1802",
      "dwc:collectionID" : "urn:uuid:c87a0756-fdd7-4cb6-9921-ca5774f8330e",
      "dwc:minimumElevationInMeters" : "1524",
      "dwc:verbatimElevation" : "5000'",
      "dwc:startDayOfYear" : "228",
      "dwc:month" : "8",
      "dwc:rights" : "http://creativecommons.org/licenses/by-nc-sa/3.0/",
      "dwc:stateProvince" : "Arizona",
      "dwc:genus" : "Curculionidae",
      "dwc:institutionCode" : "NAU",
      "dwc:county" : "Pima"
  }
}
</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

Navigation menu