1,554
edits
(add screenshot of jsonview extension) |
(fix auto-gen table of contents location, add some code tags, other minor tweaks) |
||
Line 1: | Line 1: | ||
See [[IDigBio API]] for full documentation on the API including all of the available endpoints. | This document is a list of examples for using the iDigBio API but may not be comprehensive. See [[IDigBio API]] for full documentation on the API including all of the available endpoints. | ||
=== Viewing JSON Output === | |||
A short JSON document is returned by the API when calling the GET method against the base URL: | |||
<pre> | <pre> | ||
Line 12: | Line 10: | ||
</pre> | </pre> | ||
This becomes easier to read | For best viewing of JSON results in a browser, one may wish to use the JSONView Extension for Chrome and Firefox. | ||
'''JSONView Browser Extension Example''' | |||
[[File:JSONView_browser_extension_example.png|border|JSONView extension allows easier viewing in a web browser]] | |||
If using a command-line tool (such as <code>curl</code>), you may wish to format the output of the JSON document using a "pretty printing" feature of some kind. This will make it more readable by humans and also allow it to be more easily filtered using tools such as <code>grep</code>. | |||
This becomes easier to read when the output is piped through a formatter such as python's json.tool or the json_pp command-line Perl script (JSON::PP). | |||
'''json.tool Example''' | '''json.tool Example''' | ||
Line 34: | Line 40: | ||
</pre> | </pre> | ||
=== Fetch A Single Record from the API === | === Fetch A Single Record from the API === |
edits