Remote API for the Finnish Entomological Database
Matti Virtala, 2012
1. Introduction
2. Alphabetical List of the API Commands
3. The API Commands
1. Introduction
This document describes the current remote JSONP API for the Finnish Entomological Database. More API methods can be added in future, so you might want to temporarily check out this documentation for new additions.
For most methods a simple html page, using the jQuery library, is presented. This will give you an idea how a certain method can be used.
The html page contains an element <div id='result'></div>. The JavaScript file retrieves the data from the server and inserts the list of records into the div with the jQuery method $('#result').html(list).
More advanced applications work basically in the same way: results are inserted dynamically into an html page. The flexibility of the remote interface is demonstrated by the database interface application Finnish Entomological database, which is implemented entirely using the remote API.
2. Alphaphetical List of the API Commands
eurefToYkj
getAllGenera
getCounts
getFamilies
getFamilyAndRegion
getGenera
getObsData
getObserverAndRegion
getObservers
getSpecies
getTotalCount
getYearlyObserved
search
3. The API Commands
eurefToYkj
A utility to convert a EUREF coordinate into a Finnish YKJ
coordinate.
URL:
http://hyonteiset.luomus.fi/insects/json?op=eurefToYkj&euref=7214227:8440171
Parameters:
parameter | description | usage |
---|---|---|
euref | The euref coordinate | euref=7214227:8440171 |
parameter | description | usage |
---|---|---|
order | Insect order | order=het |
parameter | description | usage |
---|---|---|
order | Insect order | order=col |
category | Defines the categories in which the counts are calculated. | category=region category=year category=storingYear category=family |
count | Determines whether the number of observations or number of species are calculated. | count=nbrObs count=nbrSpecies |
countStartYear | If category=year, countStartYear can be used to define the starting year. Defaults to 1950. | countStartYear=1990 |
query parameters | In addition to 'category' and 'count', other parameters can also be provided. These parameters delimit the set of observations for which the counts are calculated. | family=Carabidae See search for additional examples on providing query parameters. |
Example: GetCounts.html
getFamilies
Returns the families in the given order.
URL:
http://hyonteiset.luomus.fi/insects/json?op=getFamilies&order=lep
http://hyonteiset.luomus.fi/insects/json?op=getFamilies&order=lep&orderBy=speciesNbr
Parameters:
parameter | description | usage |
---|---|---|
order | Insect order | order=lep |
orderBy | Sort order of the families | not present - If not present, the families are sorted alphabetically orderBy=speciesNbr - the families are sorted in taxonomic order |
parameter | description | usage |
---|---|---|
order | insect order | order=col |
parameter | description | usage |
---|---|---|
order | Insect order | order=dip |
family | The family | family=Syrphidae |
orderBy | sort order of the genera | not present - If not present, the genera are sorted alphabetically orderBy=speciesNbr - the genera are sorted in taxonomic order |
Example: GetGenera.html
getObsData
For personal use. Returns the observation data for the given obsID.
Note that you can use search to retrieve observation data without needing to provide a username and password.
URL:
http://hyonteiset.luomus.fi/insects/json?op=getObsData&order=ara&obsID=9661-1216-6008-4622&username=uname&password=pw
Parameters:
parameter | description | usage |
---|---|---|
order | Insect order | order=ara |
obsID | Observation id | obsID=9661-1216-6008-4622 |
username | Your username | username=your_username |
password | Your password | password=your_password |
The following fields are returned:
obsID
genus
species
mCount
fCount
tCount
devStage
region
county
locality
ykjCoordinates
eurefCoordinates
originalGrid
startDay
startMonth
endDay
endMonth
year
habitat
method
observe
det
detYear
detMethod
note
hideExactData
hideCoord
hideObserver
reliability
checked
Example:
getObserverAndRegion
Returns the number of observations for each observer and region.
URL:
http://hyonteiset.luomus.fi/insects/json?op=getObserverAndRegion&order=het
Parameters:
parameter | description | usage |
---|---|---|
order | Insect order | order=het |
parameter | description | usage |
---|---|---|
order | Insect order | order=tri |
parameter | description | usage |
---|---|---|
order | Insect order | order=ara |
family | The family | family=Agelenidae |
genus | The genus | genus=Tegenaria |
orderBy | Sort order of the species | not present - If not present, the species are sorted alphabetically orderBy=speciesNbr - the species are sorted in taxonomic order |
parameter | description | usage |
---|---|---|
order | Insect order | order=ple |
parameter | description | usage |
---|---|---|
order | Insect order | order=col |
field | example |
---|---|
obsID | obsID=1234-5678-9012-3456 |
storingDate | storingDate=2003* storingDate=2003-05* |
order | order=col |
family | family=Carabidae |
genus | genus=Amara |
species | species=aulica |
region | region=Oba |
county | county=Oulu |
locality | locality=Hietasaari |
coordinates | coordinates=721:342 |
startDay | startDay=1 |
startMonth | startMonth=6 |
endDay | endDay=31 |
endMonth | endMonth=6 |
startYear | startYear=2012 |
endYear | endYear=2012 |
habitat | habitat=niitty habitat=*niitty |
method | method=ansakuopilla method=ansa* |
observer | observer=M. Virtala observer=*Virtala |
det | det=*Virtala |
detYear | detYear=2012 |
detMethod | detMethod=lab. määritys |
reliability | reliability=0 |
checked | checked=Tarkistettava* |
speciesFreq | speciesFreq=60 |
uhex | uhex='NT' |
Additional criteria can be defined with a userCondition parameter, for example as follows:
userCondition=speciesFreq >= 60
userCondition=today // Observations made today
userCondition=yesterday // Observations made yesterday
userCondition=yesterday+ // Observations made yesterday and today
userCondition=week // Observations made last week
The ordering of the records is defined by the orderBy parameter, e.g.
orderBy=region,year
By default, observations are presented in taxonomic order.
Output fields
The data fields which will be included in the result set are defined by the select parameter. The following output fields are available:
obsID
storingDate
family
genus
species
speciesFreq
uhex
region
county
locality
coordinates
startDay
startMonth
endDay
endMonth
year
habitat
method
observer
det
detYear
detMethod
note
reliability
checked
These are raw fields which are stored in the database. In addition, the following derived values can also be used:
all
speciesName
obsLocation
coordinates10x10
obsDate
Duplicate records can be omitted by using the DISTINCT keyword, e.g.
select="DISTINCT genus,species"
Example: The all parameter
The output criterion select=all provides an easy way to include all output fields into the result. For example, the url
http://localhost:8080/insects/json?op=search&order=COL&obsID=9557-2467-8340-6282&select=all
produces the following result: