IDigBio API v1 Examples: Difference between revisions

Jump to navigation Jump to search
change search query to limit size to 3 records
(change search query to limit size to 3 records)
Line 547: Line 547:
# "stateprovince" is equal to "Ohio" (there are multiple Fairfield counties throughout the world so we need to restrict the geography by state)
# "stateprovince" is equal to "Ohio" (there are multiple Fairfield counties throughout the world so we need to restrict the geography by state)


The query parameter string will look something like this:
The essential query parameter string will look something like this:


<pre>
<pre>
Line 553: Line 553:
</pre>
</pre>


With the full curl call as follows:
In addition, it is possible to request more or fewer records at a time using the "from" and "size" parameters.  Below is the full curl example requesting only the first 3 records and grep'ing out only the iDigBio GUID field. Note that we put the URL in quotes to keep the shell from trying to interpret it.


<pre>
<pre>
$ curl -s "http://search.idigbio.org/idigbio/records/_search?q=hasImage:true+AND+county:(fairfield+OR+hocking)+AND+stateprovince:ohio" | json_pp  | egrep "\"uuid\""
$ curl -s "http://search.idigbio.org/idigbio/records/_search?from=0&size=3&q=hasImage:true+AND+county:(fairfield+OR+hocking)+AND+stateprovince:ohio" | json_pp  | egrep "\"uuid\""  
               "uuid" : "20ad60a8-4126-4cc0-9378-411a9a640005",
               "uuid" : "20ad60a8-4126-4cc0-9378-411a9a640005",
               "uuid" : "ecf14f53-d225-4eb5-89e6-66379b360781",
               "uuid" : "ecf14f53-d225-4eb5-89e6-66379b360781",
               "uuid" : "ff69483e-ab19-4fa7-9ca3-d99089280af6",
               "uuid" : "ff69483e-ab19-4fa7-9ca3-d99089280af6",
              "uuid" : "024ce788-ecdf-424c-9756-92137e4ec3ba",
              "uuid" : "6bdbc686-6e37-465a-83a8-b49c7cf01a7a",
              "uuid" : "e415c235-53fc-4022-aa0b-2913fd687a7e",
              "uuid" : "baaba93a-bbe4-4ed6-9937-4220d80bdc85",
              "uuid" : "2c2846ba-de11-47ac-ace9-0006aeeac083",
              "uuid" : "b8e1e2e0-35f1-495f-a3d7-a786c0050aa4",
              "uuid" : "ba1fe9bb-1fbf-4193-b395-51436dbe3bf4",
</pre>
</pre>


1,554

edits

Navigation menu