IDigBio API v1 Examples: Difference between revisions
(created) |
(add pretty_print) |
||
Line 1: | Line 1: | ||
See [[IDigBio APIs]] for documentation on the APIs beyond what is provided here. | See [[IDigBio APIs]] for documentation on the APIs beyond what is provided here. | ||
=== Fetch A Single Record from the API === | |||
http://api.idigbio.org/v1/records/c93ebbee-64b5-4452-9e80-93bbfb11b815 | |||
In this example we access a single record via its iDigBio uuid and pipe the output to a JSON pretty print program. | |||
<pre> | |||
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" | |||
} | |||
} | |||
</pre> | |||
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 | |||
|} |
Revision as of 15:41, 22 April 2014
See IDigBio APIs for documentation on the APIs beyond what is provided here.
Fetch A Single Record from the API
http://api.idigbio.org/v1/records/c93ebbee-64b5-4452-9e80-93bbfb11b815
In this example we access a single record via its iDigBio uuid and pipe the output to a JSON pretty print program.
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 |}