1,554
edits
(notes on curl) |
|||
Line 2: | Line 2: | ||
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. | ||
For best sampling of JSON results in a browser, you may wish to use the JSONView Extension for Chrome and Firefox. | |||
Most of our examples here will look at a text-based version of the data. | |||
=== Fetch A Single Record from the API === | === Fetch A Single Record from the API === | ||
Example URL: | |||
http://api.idigbio.org/v1/records/c93ebbee-64b5-4452-9e80-93bbfb11b815 | |||
Viewing the | |||
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. | 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. | ||
Example API Results: | |||
<pre> | <pre> | ||
Line 55: | Line 69: | ||
=== Fetch 5 MediaRecords from the API === | |||
Example URL: | |||
http://api.idigbio.org/v1/mediarecords?limit=5 | |||
Example API Results: | |||
<pre> | |||
curl -s http://api.idigbio.org/v1/mediarecords?limit=5 | json_pp | |||
{ | |||
"idigbio:errors" : [], | |||
"idigbio:links" : { | |||
"idigbio:nextPage" : "http://api.idigbio.org/v1/mediarecords?limit=5&offset=5" | |||
}, | |||
"idigbio:items" : [ | |||
{ | |||
"idigbio:links" : { | |||
"mediarecord" : "http://api.idigbio.org/v1/mediarecords/000003cd-0cca-421b-8f26-f557a26b0393" | |||
}, | |||
"idigbio:uuid" : "000003cd-0cca-421b-8f26-f557a26b0393", | |||
"idigbio:version" : 1, | |||
"idigbio:etag" : "ce3e2f7272ec996bb479c87549ba90c15ba96426", | |||
"idigbio:dateModified" : "2014-04-21T22:19:27.436Z" | |||
}, | |||
{ | |||
"idigbio:links" : { | |||
"mediarecord" : "http://api.idigbio.org/v1/mediarecords/00000728-ffb3-4a68-9f93-137f19961121" | |||
}, | |||
"idigbio:uuid" : "00000728-ffb3-4a68-9f93-137f19961121", | |||
"idigbio:version" : 2, | |||
"idigbio:etag" : "c13b10675b4a83031b1dc7a24c1f5c4e443b1939", | |||
"idigbio:dateModified" : "2014-04-03T17:43:18.145Z" | |||
}, | |||
{ | |||
"idigbio:links" : { | |||
"mediarecord" : "http://api.idigbio.org/v1/mediarecords/00000b03-e208-4d22-983b-506ad2842f7c" | |||
}, | |||
"idigbio:uuid" : "00000b03-e208-4d22-983b-506ad2842f7c", | |||
"idigbio:version" : 2, | |||
"idigbio:etag" : "bc118a7ea53e004c82ab9b7e813e1010ae5f8e17", | |||
"idigbio:dateModified" : "2014-04-20T05:16:20.389Z" | |||
}, | |||
{ | |||
"idigbio:links" : { | |||
"mediarecord" : "http://api.idigbio.org/v1/mediarecords/000010bc-a4d4-483d-b71d-0dbdd4fd2d5a" | |||
}, | |||
"idigbio:uuid" : "000010bc-a4d4-483d-b71d-0dbdd4fd2d5a", | |||
"idigbio:version" : 0, | |||
"idigbio:etag" : "68c441bd3c49507bf930f3b278f2c58f9cb792ec", | |||
"idigbio:dateModified" : "2014-04-20T21:38:46.679Z" | |||
}, | |||
{ | |||
"idigbio:links" : { | |||
"mediarecord" : "http://api.idigbio.org/v1/mediarecords/000012f9-d288-4a14-b898-77430e0a137a" | |||
}, | |||
"idigbio:uuid" : "000012f9-d288-4a14-b898-77430e0a137a", | |||
"idigbio:version" : 0, | |||
"idigbio:etag" : "0357f74dada8b21a69281b042a52f47a172fa33b", | |||
"idigbio:dateModified" : "2014-01-20T20:19:29.754Z" | |||
} | |||
], | |||
"idigbio:itemCount" : "2199334" | |||
} | |||
</pre> | |||
To Do: Provide examples of displaying multiple images accessed via the mediarecord API endpoint. | |||
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 | |||
|} | |} |
edits