-
Notifications
You must be signed in to change notification settings - Fork 5
Code Samples
Dan Stoner edited this page Apr 22, 2015
·
25 revisions
This page will include samples of code against the iDigBio Search API.
A query submitted as a GET request must be URL-encoded.
For example, a request in the iDigBio query format (JSON) for a particular scientific name:
{
"rq": {
"scientificname": "puma concolor"
}
}without whitespace, still valid JSON, becomes:
{"rq":{"scientificname":"puma concolor"}}becomes the following when url-encoded:
rq=%7B%22scientificname%22%3A+%22puma+concolor%22%7D
The query requested via HTTP GET with a curl command, adding a limit of 5:
curl -s 'http://beta-search.idigbio.org/v2/search/records/?rq=%7B%22scientificname%22%3A+%22puma+concolor%22%7D&limit=5
A query submitted as a POST request must be supplied as JSON in the content body and specify the "Content-Type: application/json" request header.
...