IDigBio API v1 Examples

From iDigBio
Revision as of 15:43, 22 April 2014 by Dstoner (talk | contribs) (notes on curl)
Jump to navigation Jump to search

See IDigBio APIs for documentation on the APIs beyond what is provided here.


Fetch A Single Record from the API

In this example we use the curl command-line utility to fetch a single record from the API using the record's iDigBio uuid, then pipe the output to a JSON pretty printing program for human readability.

http://api.idigbio.org/v1/records/c93ebbee-64b5-4452-9e80-93bbfb11b815

$ curl -s http://api.idigbio.org/v1/records/c93ebbee-64b5-4452-9e80-93bbfb11b815 | json_pp
{
   "idigbio:uuid" : "c93ebbee-64b5-4452-9e80-93bbfb11b815",
   "idigbio:etag" : "9c1eb0e2c0b94543f69dad5005f700d77f118ff7",
   "idigbio:links" : {
      "owner" : [
         "872733a2-67a3-4c54-aa76-862735a5f334"
      ],
      "recordset" : [
         "http://api.idigbio.org/v1/recordsets/6bb853ab-e8ea-43b1-bd83-47318fc4c345"
      ]
   },
   "idigbio:version" : 10,
   "idigbio:createdBy" : "872733a2-67a3-4c54-aa76-862735a5f334",
   "idigbio:recordIds" : [
      "6bb853ab-e8ea-43b1-bd83-47318fc4c345\\6CB7D2F5-C76E-43FD-BACD-097EC550BA18"
   ],
   "idigbio:dateModified" : "2014-04-01T23:17:14.780Z",
   "idigbio:data" : {
      "dwc:catalogNumber" : "125191-Mollusca",
      "dwc:specificEpithet" : "gibberulus",
      "dwc:class" : "Gastropoda",
      "dwc:occurrenceID" : "6CB7D2F5-C76E-43FD-BACD-097EC550BA18",
      "dwc:infraspecificEpithet" : "gibbosus",
      "dwc:recordedBy" : "Kohr, H. H.",
      "dwc:scientificName" : "Strombus gibberulus",
      "dwc:family" : "Strombidae",
      "dwc:basisOfRecord" : "PreservedSpecimen",
      "dwc:collectionCode" : "Invertebrate Zoology",
      "dcterms:modified" : "03/21/2014",
      "dwc:decimalLongitude" : "144.8",
      "dwc:country" : "USA",
      "dwc:scientificNameAuthorship" : "Röding",
      "dwc:locationID" : "ZZZ-072834",
      "dwc:stateProvince" : "Mariana Islands",
      "dwc:genus" : "Strombus",
      "dwc:decimalLatitude" : "13.5",
      "dwc:institutionCode" : "FLMNH",
      "dwc:order" : "Mesogastropoda",
      "dwc:county" : "Guam Island"
   }
}


Controls the number of records returned by a collection url. Large numbers may cause requests to time out, but are significantly more efficient when attempting to query large numbers of records. | http://api.idigbio.org/v1/mediarecords?limit=100 |- | offset | Collections | [0-] | Controls how many records to skip forward when paging through the API. Large offsets are extremely inefficient, so combinations of small limits and large offsets may cause requests to fail. | http://api.idigbio.org/v1/mediarecords?limit=100&offset=100 |- | version | Entities | [0-current version], -1 for latest version | Return a specific version of a record from the data store. Can be used to query historical data for iDigBio records. | http://api.idigbio.org/v1/records/c93ebbee-64b5-4452-9e80-93bbfb11b815?version=0 |- | quality | Entities | ["thumbnail", "web"], | Specifiy the quality of the image returned from the API (valid values are "thumbnail" and "web"). | https://api.idigbio.org/v1/records/4e98d066-f35f-4cc0-ad7c-b5b5f2175521/media?quality=thumbnail https://api.idigbio.org/v1/mediarecords/4c4c5008-5444-4348-85f5-34112b46169b/media?quality=web |}