IDigBio API v1 Examples: Difference between revisions

fix auto-gen table of contents location, add some code tags, other minor tweaks
(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.


For best sampling of JSON results in a browser, you may wish to use the JSONView Extension for Chrome and Firefox.
=== Viewing JSON Output ===


In most cases for these examples we format the output of the JSON document using a "pretty printing" feature of some kind in order to make this document more readable by humans.
A short JSON document is returned by the API when calling the GET method against the base URL:
 
For example, this is the raw JSON returned by the base URL of the API:


<pre>
<pre>
Line 12: Line 10:
</pre>
</pre>


This becomes easier to read if we pipe the output through a formatter such as python's json.tool or the json_pp command-line Perl script (JSON::PP).
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>


'''JSONView Browser Extension Example'''
[[File:JSONView_browser_extension_example.png|border|JSONView extension allows easier viewing in a web browser]]


=== Fetch A Single Record from the API ===
=== Fetch A Single Record from the API ===
1,554

edits