API services
How to import and get data!
Every OpenDataBio installation provide a API service, allowing users to GET data programmatically, and collaborators to POST new data into its database. The service is open access to public data, requires user authentication to POST data or GET data of restricted access.
The OpenDataBio API (Application Programming Interface -API) allows users to interact with an OpenDataBio database for exporting, importing and updating data without using the web-interface.
The OpenDataBio R package is a client for this API, allowing the interaction with the data repository directly from R and illustrating the API capabilities so that other clients can be easily built.
The OpenDataBio API allows querying of the database, data importation and data edition (update) through a REST inspired interface. All API requests and responses are formatted in JSON.
The API call
A simple call to the OpenDataBio API has four independent pieces:
[HTTP-verb] + base-URL + endpoint + request-parameters
- HTTP-verb - either
GET
for exports or POST
for imports. - base-URL - the URL used to access your OpenDataBio server + plus
/api/v0
. For, example, http://opendatabio.inpa.gov.br/api/v0
- endpoint - represents the object or collection of objects that you want to access, for example, for querying taxonomic names, the endpoint is “taxons”
- request-parameters - represent filtering and processing that should be done with the objects, and are represented in the API call after a question mark. For example, to retrieve only valid taxonomic names (non synonyms) end the request with
?valid=1
.
The API call above can be entered in a browser to GET public access data. For example, to get the list of valid taxons from an OpenDataBio installation the API request could be:
https://opendb.inpa.gov.br/api/v0/taxons?valid=1&limit=10
When using the OpenDataBio R package this call would be odb_get_taxons(list(valid=1))
.
A response would be something like:
{
"meta":
{
"odb_version":"0.9.1-alpha1",
"api_version":"v0",
"server":"http://opendb.inpa.gov.br",
"full_url":"https://opendb.inpa.gov.br/api/v0/taxons?valid=1&limit1&offset=100"},
"data":
[
{
"id":62,
"parent_id":25,
"author_id":null,
"scientificName":"Laurales",
"taxonRank":"Ordem",
"scientificNameAuthorship":null,
"namePublishedIn":"Juss. ex Bercht. & J. Presl. In: Prir. Rostlin: 235. (1820).",
"parentName":"Magnoliidae",
"family":null,
"taxonRemarks":null,
"taxonomicStatus":"accepted",
"ScientificNameID":"http:\/\/tropicos.org\/Name\/43000015 | https:\/\/www.gbif.org\/species\/407",
"basisOfRecord":"Taxon"
}]}
API Authentication
- Not required for getting any data with public access in the ODB database, which by default includes locations, taxons, bibliographic references, persons and traits.
- Authentication Required to GET any data that is not of public access, and is required to POST and PUT data.
- Authentication is done using an
API token
, that can be found under your user profile on the web interface. The token is assigned to a single database user, and should not be shared, exposed, e-mailed or stored in version controls. - To authenticate against the OpenDataBio API, use the token in the “Authorization” header of the API request. When using the R client, pass the token to the
odb_config
function cfg = odb_config(token="your-token-here")
. - The token controls the data you can get and can edit
Users will only have access to the data for which the user has permission and to any data with public access in the database, which by default includes locations, taxons, bibliographic references, persons and traits. Measurements, individuals, and Vouchers access depends on permissions understood by the users token.
API versions
The OpenDataBio API follows its own version number. This means that the client can expect to use the same code and get the same answers regardless of which OpenDataBio version that the server is running. All changes done within the same API version (>= 1) should be backward compatible. Our API versioning is handled by the URL, so to ask for a specific API version, use the version number between the base URL and endpoint:
https://opendatabio.inpa.gov.br/opendatabio/api/v1/taxons
https://opendatabio.inpa.gov.br/opendatabio/api/v2/taxons
1 - Quick reference
List of endpoints and parameters!
API call format
base-URL + ‘/api/v0/’ + endpoint + ‘?’ + request-parametersGET DATA (downloads)
Shared get-parameters
When multiple parameters are specified, they are combined with an AND operator. There is no OR parameter option in searches.
All endpoints share these GET parameters:
id
return only the specified resource. May be number or a comma delimited list, such as api/v0/locations?id=1,50,124
limit
: the number of items that should be returned (must be greater than 0). Example: api/v0/taxons?limit=10
offset
: the initial record to extract, to be used with limit when trying to download a large amount of data. Example: api/v0/taxons?offset=10000&limit=10000
returns 10K records starting from the 10K position of the current query.fields
: the field or fields that should be returned. Each endpoint has its own fields but there are two special words, simple (default) and all, which return different collection of fields. fields=all
may return sub-objects for each object. fields ='raw'
will return the raw table, speeding up the search, although values may be more difficult to understand. Example: api/v0/taxons?fields=id,scientificName,valid
save_job
: for large data retrieval, if you add save_job=1
to the params list a job will be created for your search, and the data can then be obtained using the userjobs api.
Download large datasets?
The
limit
and
offset
parameters can be used to divide your search into parts. Alternatively, use the
save_job=T
option and then download the data with the
get_file=T
parameter from the
userjobs API.
wildcards
Some parameters accept an asterisk as wildcard, so api/v0/taxons?name=Euterpe
will return taxons with name exactly as “Euterpe”, while api/v0/taxons?name=Eut*
will return names starting with “Eut”.Endpoint parameters
Endpoint | Description | Possible parameters |
---|
/ | Tests your access | none |
bibreferences | Lists of bibliographic references | id , bibkey |
biocollections | List of Biocollections and other vouchers Repositories | id |
datasets | Lists registered datasets or downloand the files of dataset versions | id , list_versions , file_name |
individuals | Lists registered individuals | id , location , location_root ,taxon , taxon_root , tag ,project , dataset |
individual-locations | Lists occurrences for individuals | individual_id , location , location_root ,taxon , taxon_root , dataset |
languages | Lists registered languages | |
measurements | Lists Measurements | id , taxon ,taxon_root ,dataset ,trait ,individual ,voucher ,location ,location_root |
media | Lists Media Metadata | id , taxon ,taxon_root ,dataset ,individual ,voucher ,location ,location_root |
locations | Lists locations | root , id , parent_id ,adm_level , name , limit , querytype , lat , long ,project ,dataset |
persons | Lists registered people | id , search , name , abbrev , email |
projects | Lists registered projects | id only |
taxons | Lists taxonomic names | root , id , name ,level , valid , external , project ,dataset |
traits | Lists variables (traits) list | id , name |
vernacular | Lists vernaculars | id , individual ,taxon ,taxon_root |
vouchers | Lists registered voucher specimens | id , number , individual , location , collector , location_root ,taxon , taxon_root , project , dataset |
userjobs | Lists user Jobs | id , status ,get_file |
POST DATA (imports)
Web-interface note
- Importing data from files through the web-interface require specifying the POST verb parameters of the ODB API
- Batch imports of Bibliographic References and MediaFiles are possible only through the web interface.
Endpoint | Description | POST Fields |
---|
bibreferences | Import BibReferences | doi or bibtex |
biocollections | Import BioCollections | name , acronym |
individuals | Import individuals | collector , tag , dataset , date , (location or latitude + longitude )**, altitude , location_notes , location_date_time , x , y , distance , angle , notes , taxon , identifier , identification_date , modifier , identification_notes , identification_based_on_biocollection , identification_based_on_biocollection_id , identification_individual |
individual-locations | Import IndividualLocations | individual , (location or latitude + longitude ), altitude , location_notes , location_date_time , x , y , distance , angle |
locations | Import locations | name , adm_level , (geom or lat +long )** , parent , altitude , datum , x , y , startx , starty , notes , ismarine |
measurements | Import Measurements to Datasets | dataset , date , object_type , object_id , person , trait_id , value **, link_id , bibreference , notes , duplicated ,location , parent_measurement |
media | Import Media | a zip file containing media and an attribute table see details here |
persons | Imports a list of people | full_name **, abbreviation , email , institution , biocollection |
traits | Import traits | export_name , type , objects , name , description **, units , range_min , range_max , categories , wavenumber_min and wavenumber_max , value_length , link_type , bibreference , tags |
taxons | Imports taxonomic names | name **, level , parent , bibreference , author , author_id or person , valid , mobot , ipni , mycobank , zoobank , gbif |
vouchers | Imports voucher specimens | individual , biocollection , biocollection_type , biocollection_number , number , collector , date , dataset , notes |
vernacular | Imports Vernaculars | name , language ,taxons ,individuals ,citations ,parent ,type |
PUT DATA (updates)
Attention
Only the endpoints listed below can be updated using the API and only the listed PUT fields can be updated on each endpoint. Field values are as explained for the POST API endpoints, except that in all cases you must also provide the id
of the record to be updated.Endpoint | Description | PUT Fields |
---|
individuals | Update Individuals | (id or individual_id ),collector , tag , dataset , date , notes , taxon , identifier , identification_date , modifier , identification_notes , identification_based_on_biocollection , identification_based_on_biocollection_id , identification_individual |
individual-locations | Update Individual Locations | (id or individual_location_id ), individual , (location or latitude + longitude ), altitude , location_notes , location_date_time , x , y , distance , angle |
locations | Update Locations | (id or location_id ), name , adm_level , (geom or lat +long ) , parent , altitude , datum , x , y , startx , starty , notes , ismarine |
measurements | Update Measurements | (id or measurement_id ), dataset , date , object_type , object_type , person , trait_id , value , link_id , bibreference , notes , duplicated ,location , parent_measurement |
media | Update Media Metadata | (media_id ou media_uuid ), collector ,tags , date , title_en , title_pt , license , dataset , project , notes , (location ou longitude + latitude ) |
persons | Update Persons | (id or person_id ),full_name , abbreviation , email , institution , biocollection |
vouchers | Update Vouchers | (id or voucher_id ),individual , biocollection , biocollection_type , biocollection_number , number , collector , date , dataset , notes |
Nomenclature types
Nomenclature types numeric codes | |
---|
NotType : 0 | Isosyntype : 8 |
Type : 1 | Neotype : 9 |
Holotype : 2 | Epitype : 10 |
Isotype : 3 | Isoepitype : 11 |
Paratype : 4 | Cultivartype : 12 |
Lectotype : 5 | Clonotype : 13 |
Isolectotype : 6 | Topotype : 14 |
Syntype : 7 | Phototype : 15 |
Taxon Level (Rank)
Level | Level | Level | Level |
---|
-100 clade | 60 cl., class | 120 fam., family | 210 section, sp., spec., species |
0 kingdom | 70 subcl., subclass | 130 subfam., subfamily | 220 subsp., subspecies |
10 subkingd. | 80 superord., superorder | 150 tr., tribe | 240 var., variety |
30 div., phyl., phylum, division | 90 ord., order | 180 gen., genus | 270 f., fo., form |
40 subdiv. | 100 subord. | 190 subg., subgenus, sect. | |
2 - GET data
How to GET data with the OpenDataBio API!
- The OpenDataBio R package is a client for this API.
- No authentication required to access data with a public access policy
- Authentication token required only to get data with a non-public access policy
Shared GET parameters
When multiple parameters are specified, they are combined with an AND operator. There is no OR parameter option in searches.
All endpoints share these GET parameters:
id
return only the specified resource. May be number or a comma delimited list, such as api/v0/locations?id=1,50,124
limit
: the number of items that should be returned (must be greater than 0). Example: api/v0/taxons?limit=10
offset
: the initial record to extract, to be used with limit when trying to download a large amount of data. Example: api/v0/taxons?offset=10000&limit=10000
returns 10K records starting from the 10K position of the current query.fields
: the field or fields that should be returned. Each endpoint has its own fields but there are two special words, simple (default) and all, which return different collection of fields. fields=all
may return sub-objects for each object. fields ='raw'
will return the raw table, speeding up the search, although values may be more difficult to understand. Example: api/v0/taxons?fields=id,scientificName,valid
save_job
: for large data retrieval, if you add save_job=1
to the params list a job will be created for your search, and the data can then be obtained using the userjobs api.
Download large datasets?
The
limit
and
offset
parameters can be used to divide your search into parts. Alternatively, use the
save_job=T
option and then download the data with the
get_file=T
parameter from the
userjobs API.
wildcards
Some parameters accept an asterisk as wildcard, so api/v0/taxons?name=Euterpe
will return taxons with name exactly as “Euterpe”, while api/v0/taxons?name=Eut*
will return names starting with “Eut”.BibReferences Endpoint
The bibreferences
endpoint interact with the bibreference table. Their basic usage is getting the registered Bibliographic References.
GET request-parameters
id=list
return only references having the id or ids provided (ex id=1,2,3,10
)bibkey=list
return only references having the bibkey or bibkeys (ex bibkey=ducke1953,mayr1992
)taxon=list of ids
return only references linked to the taxon informed.limit
and offset
limit query. see Common parameters.
Response fields
id
- the id of the BibReference in the bibreferences table (a local database id)bibkey
- the bibkey used to search and use of the reference in the web systemyear
- the publication yearauthor
- the publication authorstitle
- the publication titledoi
- the publication DOI if presenturl
- an external url for the publication if presentbibtex
- the reference citation record in BibTex format
Biocollections Endpoint
The biocollections
endpoint interact with the biocollections table. Their basic usage is getting the list of the Biological Collections registered in the database. Using for getting biocollection_id
or validating your codes for importing data with the Vouchers or Individuals endpoints.
GET request-parameters
id=list
return only ‘biocollections’ having the id or ids provided (ex id=1,2,3,10
)acronym
return only ‘biocollections’ having the acronym or acronym provided (ex acronym=INPA,SP,NY
)
Response fields
id
- the id of the repository or museum in the biocollections table (a local database id)name
- the name of the repository or museumacronym
- the repository or museum acronymirn
- only for Herbaria, the number of the herbarium in the Index Herbariorum
Datasets Endpoint
The datasets
endpoint interacts with the Datasets table and with static versions of Datasets. Useful for getting dataset_ids to import measurements, individuals, vouchers and media. You can also download files of static versions of the data, if any were generated by dataset administrators. This allows access to data from datasets in a faster way. Access to the data will depend on whether the version has a public license, or whether the user is a contributor, administrator or viewer of the dataset.
GET request-parameters
id=list
return only datasets having the id or ids provided (ex id=1,2,3,10
)list_versions = boolean
returns the list of files and versions for one or more id
datasets (eg id='1,2,3,4',list_versions=1
)file_name = string
returns the data of a single file indicated by this parameter, as indicated in the list of versions returned (eg id='1',file_name='2_Organisms.csv'
)
Response fields
With list_versions=1
dataset_id
- the id of the dataset in the dataset table (a local database id)dataset
- the name of the datasetversion
- the name of the static version of the datasetlicense
- the CreativeCommons license of the data versionaccess
- indicating if it is OpenAccess or if the user has accessget_params
- how to inform the params
argument in the odb_get_datasets() function of the R package to get the data in files
With file_name
- Returns data from the given file
Just id or nothing
id
- the id of the Dataset in the datasets table (a local database id)name
- the name of the datasetprivacyLevel
- the access level for the datasetcontactEmail
- the dataset administrator emaildescription
- a description of the datasetpolicy
- the data policy if specifiedmeasurements_count
- the number of measurements in the datasettaggedWidth
- the list of tags applied to the dataset
Individuals Endpoint
The individuals
endpoints interact with the Individual table. Their basic usage is getting a list of individuals.
GET request-parameters
id=number or list
- return individuals that have id or ids ex: id=2345,345
location=mixed
- return by location id or name or ids or names ex: location=24,25,26
location=Parcela 25ha
of the locations where the individualslocation_root
- same as location but return also from the descendants of the locations informedtaxon=mixed
- the id or ids, or canonicalName taxon names (fullnames) ex: taxon=Aniba,Ocotea guianensis,Licaria cannela tenuicarpa
or taxon=456,789,3,4
taxon_root
- same as taxon but return also all the individuals identified as any of the descendants of the taxons informedproject=mixed
- the id or ids or names of the project, ex: project=3
or project=OpenDataBio
tag=list
- one or more individual tag number/code, ex: tag=individuala1,2345,2345A
dataset=mixed
- the id or ids or names of the datasets, return individuals having measurements in the datasets informedlimit
and offset
are SQL statements to limit the amount of data when trying to download a large number of individuals, as the request may fail due to memory constraints. See Common parameters.
Note
Notice that all search fields (taxon, location and dataset) may be specified as names (eg, “taxon=Euterpe edulis”) or as database ids. If a list is specified for one of these fields, all items of the list must be of the same type, i.e. you cannot search for ’taxon=Euterpe,24’. Also, location and taxon have priority over location_root and taxon_root if both informed.Response fields
id
- the ODB id of the Individual in the individuals table (a local database id)basisOfRecord
DWC - will be always ‘organism’ [dwc organism](DWCorganismID
DWC - a local unique combination of record info, composed of recordNumber,recordedByMain,locationNamerecordedBy
DWC - pipe “|” separated list of registered Persons abbreviationsrecordedByMain
- the first person in recordedBy, the main collectorsrecordNumber
DWC - an identifier for the individual, may be the code in a tree aluminum tag, a bird band code, a collector numberrecordedDate
DWC - the record datescientificName
DWC - the current taxonomic identification of the individual (no authors) or “unidentified”scientificNameAuthorship
DWC - the taxon authorship. For taxonomicStatus unpublished: will be a ODB registered Person namefamily
DWCgenus
DWCidentificationQualifier
DWC - identification name modifiers cf. aff. s.l., etc.identifiedBy
DWC - the Person identifying the scientificName of this recorddateIdentified
DWC - when the identification was made (may be incomplete, with 00 in the month and or day position)identificationRemarks
DWC - any notes associated with the identificationlocationName
- the location name (if plot the plot name, if point the point name, …)locationParentName
- the immediate parent locationName, to facilitate use when location is subplothigherGeography
DWC - the parent LocationName ‘|’ separated (e.g. Brasil | Amazonas | Rio Preto da Eva | Fazenda Esteio | Reserva km37 | Manaus ForestGeo-PDBFF Plot | Quadrat 100x100 );decimalLatitude
DWC - depends on the location adm_level and the individual X and Y, or Angle and Distance attributes, which are used to calculate these global coordinates for the record; if individual has multiple locations (a monitored bird), the last location is obtained with this get APIdecimalLongitude
DWC - same as for decimalLatitudex
- the individual X position in a Plot locationy
- the individual Y position in a Plot locationgx
- the individual global X position in a Parent Plot location, when location is subplot (ForestGeo standards)gy
- the individual global Y position in a Parent Plot location, when location is subplot (ForestGeo standards)angle
- the individual azimuth direction in relation to a POINT reference, either when adm_level is POINT or when X and Y are also provided for a Plot location this is calculated from X and Y positionsdistance
- the individual distance direction in relation to a POINT reference, either when adm_level is POINT or when X and Y are also provided for a Plot location this is calculated from X and Y positionsorganismRemarks
DWC - any note associated with the Individual recordassociatedMedia
DWC - urls to ODB media files associated with the recorddatasetName
- the name of the ODB Dataset to which the record belongs to DWCaccessRights
- the ODB Dataset access privacy setting - DWCbibliographicCitation
- the ODB Dataset citation - DWClicense
- the ODB Dataset license - DWC
Individual-locations Endpoint
The individual-locations
endpoint interact with the individual_location table. Their basic usage is getting location data for individuals, i.e. occurrence data for organisms. Designed for occurrences of organisms that move and have multiple locations, else the same info is retrieved with the Individuals endpoint.
GET request-parameters
individual_id=number or list
- return locations for individuals that have id or ids ex: id=2345,345
location=mixed
- return by location id or name or ids or names ex: location=24,25,26
location=Parcela 25ha
of the locations where the individualslocation_root
- same as location but return also from the descendants of the locations informedtaxon=mixed
- the id or ids, or canonicalName taxon names (fullnames) ex: taxon=Aniba,Ocotea guianensis,Licaria cannela tenuicarpa
or taxon=456,789,3,4
taxon_root
- same as taxon but return also all the the locations for individuals identified as any of the descendants of the taxons informeddataset=mixed
- the id or ids or names of the datasets, return individuals belonging to the datasets informedlimit
and offset
are SQL statements to limit the amount of data when trying to download a large number of individuals, as the request may fail due to memory constraints. See Common parameters.
Note
Notice that all search fields (taxon, location and dataset) may be specified as names (eg, “taxon=Euterpe edulis”) or as database ids. If a list is specified for one of these fields, all items of the list must be of the same type, i.e. you cannot search for ’taxon=Euterpe,24’. Also, location and taxon have priority over location_root and taxon_root if both informed.Response fields
individual_id
- the ODB id of the Individual in the individuals table (a local database id)location_id
- the ODB id of the Location in the locations table (a local database id)basisOfRecord
- will be always ‘occurrence’ - DWC and [dwc occurrence](DWC;occurrenceID
- the unique identifier for this record, the individual+location+date_time - DWCorganismID
- the unique identifier for the Individual DWCrecordedDate
- the occurrence date+time observation - DWClocationName
- the location name (if plot the plot name, if point the point name, …)higherGeography
- the parent LocationName ‘|’ separated (e.g. Brasil | Amazonas | Rio Preto da Eva | Fazenda Esteio | Reserva km37 | Manaus ForestGeo-PDBFF Plot | Quadrat 100x100 ) - DWCdecimalLatitude
- depends on the location adm_level and the individual X and Y, or Angle and Distance attributes, which are used to calculate these global coordinates for the record - DWCdecimalLongitude
- same as for decimalLatitude - DWCgeoreferenceRemarks
- will contain the explanation of the type of decimalLatitude - DWCx
- the individual X position in a Plot locationy
- the individual Y position in a Plot locationangle
- the individual azimuth direction in relation to a POINT reference, either when adm_level is POINT or when X and Y are also provided for a Plot location this is calculated from X and Y positionsdistance
- the individual distance direction in relation to a POINT reference, either when adm_level is POINT or when X and Y are also provided for a Plot location this is calculated from X and Y positionsminimumElevation
- the altitude for this occurrence record if any - DWCoccurrenceRemarks
- any note associated with this record - DWCscientificName
- the current taxonomic identification of the individual (no authors) or “unidentified” - DWCfamily
- the current taxonomic family name, if apply - DWCdatasetName
- the name of the ODB Dataset to which the record belongs to - DWCaccessRights
- the ODB Dataset access privacy setting - DWCbibliographicCitation
- the ODB Dataset citation - DWClicense
- the ODB Dataset license DWC
Measurements Endpoint
The measurements
endpoint interact with the measurements table. Their basic usage is getting Data linked to Individuals, Taxons, Locations or Vouchers, regardless of datasets, so it is useful when you want particular measurements from different datasets that you have access for. If you want a full dataset, you may just use the web interface, as it prepares a complete set of the dataset measurements and their associated data tables for you.
GET request-parameters
id=list of ids
return only the measurement or measurements having the id or ids provided (ex id=1,2,3,10
)taxon=list of ids or names
return only the measurements related to the Taxons, both direct taxon measurements and indirect taxon measurements from their individuals and vouchers (ex taxon=Aniba,Licaria
). Does not consider descendants taxons for this use taxon_root
instead. In the example only measurements directly linked to the genus and genus level identified vouchers and individuals will be retrieved.taxon_root=list of ids or names
similar to taxon
, but get also measurements for descendants taxons of the informed query (ex taxon=Lauraceae
will get measurements linked to Lauraceae and any taxon that belongs to it;dataset=list of ids
return only the measurements belonging to the datasets informed (ex dataset=1,2
) - allows to get all data from a dataset.trait=list of ids or export_names
return only the measurements for the traits informed (ex trait=DBH,DBHpom
or dataset=2?trait=DBH
) - allows to get data for a particular traitindividual=list of individual ids
return only the measurements for the individual ids informed (ex individual=1000,1200
)voucher=list of voucher ids
return only the measurements for the voucher ids informed (ex voucher=345,321
)location=list of location ids
return only measurements for the locations ids informed (ex location=4,321
)- does not retrieve measurements for individuals and vouchers in those locations, only measured locations, like plot soil surveys data.limit
and offset
are SQL statements to limit the amount of data when trying to download a large number of measurements, as the request may fail due to memory constraints. See Common parameters.
Response fields
id
- the Measurement ODB id in the measurements table (local database id)basisOfRecord
DWC - will be always ‘MeasurementsOrFact’ [dwc measurementorfact](DWCmeasured_type
- the measured object, one of ‘Individual’, ‘Location’, ‘Taxon’ or ‘Voucher’measured_id
- the id of the measured object in the respective object table (individuals.id, locations.id, taxons.id, vouchers.id)measurementID
DWC - a unique identifier for the Measurement record - combine measured resourceRelationshipID, measurementType and datemeasurementType
DWC - the export_name for the ODBTrait measuredmeasurementValue
DWC - the value for the measurement - will depend on kind of the measurementType (i.e. ODBTrait)measurementUnit
DWC - the unit of measurement for quantitative traitsmeasurementDeterminedDate
DWC - the Measurement measured datemeasurementDeterminedBy
DWC - Person responsible for the measurementmeasurementRemarks
DWC - text note associated with this Measurement recordresourceRelationship
DWC - the measured object (resource) - one of ’location’,’taxon’,‘organism’,‘preservedSpecimen’resourceRelationshipID
DWC - the id of the resourceRelationshiprelationshipOfResource
DWC - will always be ‘measurement of’scientificName
DWC - the current taxonomic identification (no authors) or ‘unidentified’ if the resourceRelationship object is not ’location’family
DWC - taxonomic family name if appliesdatasetName
- the name of the ODB Dataset to which the record belongs to - DWCaccessRights
- the ODB Dataset access privacy setting - DWCbibliographicCitation
- the ODB Dataset citation - DWClicense
- the ODB Dataset license - DWCmeasurementLocationId
- the ODB id of the location associated with the measurementmeasurementParentId
- the ODB id of another related measurement (the parent measurement to which the current depends upon)decimalLatitude
DWC - a latitude em graus decimais da medição ou do objeto medido.decimalLongitude
DWC - a longitude em graus decimais da medição ou do objeto medido.
The media
endpoint interact with the media table. Their basic usage is getting the metadata associated with MediaFiles and the files URL, which can be used to download them.
GET request-parameters
individual=number or list
- return media associated with the individuals having id or ids ex: id=2345,345
voucher=number or list
- return media associated with the vouchers having id or ids ex: id=2345,345
location=mixed
- return media associated with the locations having id or name or ids or names ex: location=24,25,26
location=Parcela 25ha
location_root
- same as location but return also media associated with the descendants of the locations informedtaxon=mixed
- the id or ids, or canonicalName taxon names (fullnames) ex: taxon=Aniba,Ocotea guianensis,Licaria cannela tenuicarpa
or taxon=456,789,3,4
taxon_root
- same as taxon but return also all the locations for media related to any of the descendants of the taxons informeddataset=mixed
- the id or ids or names of the datasets, return belonging to the datasets informedlimit
and offset
are SQL statements to limit the amount of data when trying to download a large number of individuals, as the request may fail due to memory constraints. See Common parameters.
Note
Notice that all search fields (taxon, location and dataset) may be specified as names (eg, “taxon=Euterpe edulis”) or as database ids. If a list is specified for one of these fields, all items of the list must be of the same type, i.e. you cannot search for ’taxon=Euterpe,24’. Also, location and taxon have priority over location_root and taxon_root if both informed.Response fields
id
- the Measurement ODB id in the measurements table (local database id)basisOfRecord
DWC - will be always ‘MachineObservation’ DWCmodel_type
- the related object, one of ‘Individual’, ‘Location’, ‘Taxon’ or ‘Voucher’model_id
- the id of the related object in the respective object table (individuals.id, locations.id, taxons.id, vouchers.id)resourceRelationship
DWC - the related object (resource) - one of ’location’,’taxon’,‘organism’,‘preservedSpecimen’resourceRelationshipID
DWC - the id of the resourceRelationshiprelationshipOfResource
DWC - will be the dwcTyperecordedBy
DWC - pipe “|” separated list of registered Persons abbreviationsrecordedDate
DWC - the media file datescientificName
DWC - the current taxonomic identification of the individual (no authors) or “unidentified”family
DWCdwcType
DWC - one of StillImage, MovingImage, SounddatasetName
- the name of the ODB Dataset to which the record belongs to DWCaccessRights
- the ODB Dataset access privacy setting - DWCbibliographicCitation
- the ODB Dataset citation - DWClicense
- the ODB Dataset license - DWCfile_name
- the file namefile_url
- the url to the filecitation
- how to cite the image.bibtex
- the bibtex citation for the imageuuid
- a unique identifier for the image
Languages EndPoint
The languages
endpoint interact with the Language table. Their basic usage is getting a list of registered Languages to import User Translations like Trait and TraitCategories names and descriptions.
Response fields
id
- the id of the language in the languages table (a local database id)code
- the language string code;name
- the language name;
Locations Endpoint
The locations
endpoints interact with the locations table. Their basic usage is getting a list of registered countries, cities, plots, etc, or importing new locations.
GET request-parameters
id=list
return only locations having the id or ids provided (ex id=1,2,3,10
)adm_level=number
return only locations for the specified level or type:- 2 for country; 3 for first division within country (province, state); 4 for second division (e.g. municipality)… up to adm_level 10 as administrative areas (Geometry: polygon, MultiPolygon);
- 97 is the code for Environmental Layers (Geometry: polygon, multipolygon);
- 98 is the code for Indigenous Areas (Geometry: polygon, multipolygon);
- 99 is the code for Conservation Units (Geometry: polygon, multipolygon);
- 100 is the code for plots and subplots (Geometry: polygon or point);
- 101 for transects (Geometry: point or linestring)
- 999 for any ‘POINT’ locations like GPS waypoints (Geometry: point);
name=string
return only locations whose name matches the search string. You may use asterisk as a wildcard. Example: name=Manaus
or name=*Ducke*
to find name that has the word Ducke;parent_id=list
return the locations for which the direct parent is in the list (ex: parent_id=2,3)root=number
number is the location id
to search, returns the location for the specified id along with all of its descendants locations; example: find the id for Brazil and use its id as root to get all the locations belonging to Brazil;querytype
one of “exact”, “parent” or “closest” and must be provided with lat
and long
:- when
querytype=exact
will find a point location that has the exact match of the lat
and long
; - when
querytype=parent
will find the most inclusive parent location within which the coordinates given by lat
and long
fall; - when
querytype=closest
will find the closest location to the coordinates given by lat
and long
; It will only search for closest locations having adm_level > 99
, see above. lat
and long
must be valid coordinates in decimal degrees (negative for South and West);
fields=list
specify which fields you want to get with your query (see below for field names), or use options ‘all’ or ‘simple’, to get full set and the most important columns, respectivelyproject=mixed
- id or name of project (may be a list) return the locations belonging to one or more Projectsdataset=mixed
- id or name of a dataset (may be a list) return the locations belonging to one or more Datasets
Notice that id
, search
, parent
and root
should probably not be combined in the same query.
Response fields
id
- the ODB id of the Location in the locations table (a local database id)basisOfRecord
DWC - will always contain ’location’ [dwc location](DWClocationName
- the location name (if country the country name, if state the state name, etc…)adm_level
- the numeric value for the ODB administrative level (2 for countries, etc)levelName
- the name of the ODB administrative levelparent_id
- the ODB id of the parent locationparentName
- the immediate parent locationNamehigherGeography
DWC - the parent LocationName ‘|’ separated (e.g. Brasil | São Paulo | Cananéia);footprintWKT
DWC - the WKT representation of the location; if adm_level==100 (plots) or adm_level==101 (transects) and they have been informed as a POINT location, the respective polygon or linestring geometries, the footprintWKT will be that generated using the location’s x and y dimensions.x
and y
- (meters) when location is a plot (100 == adm_level) its X and Y dimensions, if a transect (101 == adm_level), x may be the length and y may be a buffer dimension around the linestring.startx
and starty
- (meters) when location is a subplot (100 == adm_level with parent also adm_level==100), the X and Y start position in relation to the 0,0 coordinate of the parent plot location, which is either a Point, or the first coordinate of a Polygon geometry type;distance
- only when querytype==closest, this value will be present, and indicates the distance, in meters, the locations is from your queried coordinates;locationRemarks
DWC - any notes associated with this Location recorddecimalLatitude
DWC - depends on the adm_level: if adm_level<=99, the latitude of the centroid; if adm_level == 999 (point), its latitude; if adm_level==100 (plot) or 101 (transect), but is a POINT geometry, the POINT latitude, else if POLYGON geometry, then the first point of the POLYGON or the LINESTRING geometry.decimalLongitude
DWC - same as for decimalLatitudegeoreferenceRemarks
DWC - will contain the explanation about decimalLatitudegeodeticDatum
-DWC the geodeticDatum informed for the geometry (ODB does not treat map projections, assumes data is always is WSG84)
Persons Endpoint
The persons
endpoint interact*** with the Person table. The basic usage is getting a list of registered people (individuals and vouchers collectors, taxonomic specialists or database users).
GET request-parameters
id=list
return only persons having the id or ids provided (ex id=1,2,3,10
)name=string
- return people whose name matches the specified string. You may use asterisk as a wildcard. Ex: name=*ducke*
abbrev = string
, return people whose abbreviation matches the specified string. You may use asterisk as a wildcard.email=string
, return people whose e-mail matches the specified string. You may use asterisk as a wildcard.search=string
, return people whose name, abbreviation or e-mail matches the specified string. You may use asterisk as a wildcard.limit
and offset
are SQL statements to limit the amount of data when trying to download a large number of measurements, as the request may fail due to memory constraints. See Common parameters.
Response fields
id
- the id of the person in the persons table (a local database id)full_name
- the person name;abbreviation
- the person name (this are UNIQUE values in a OpenDataBio database)email
- the email, if registered or person is userinstitution
- the persons institution, if registerednotes
- any registered notes;biocollection
- the name of the Biological Collection (Biocollections, etc) that the person is associated with; not included in simple)
Projects EndPoint
The projects
endpoint interact with the projects table. The basic usage is getting the registered Projects.
GET request-parameters
id=list
return only projects having the id or ids provided (ex id=1,2,3,10
)
Response fields
id
- the id of the Project in the projects table (a local database id)fullname
- project nameprivacyLevel
- the access level for individuals and vouchers in ProjectcontactEmail
- the project administrator emailindividuals_count
- the number of individuals in the projectvouchers_count
- the number of vouchers in the project
Taxons Endpoint
The taxons
endpoint interact with the taxons table. The basic usage is getting a list of registered taxonomic names.
GET request-parameters
id=list
return only taxons having the id or ids provided (ex id=1,2,3,10
)name=search
returns only taxons with fullname (no authors) matching the search string. You may use asterisk as a wildcard.root=number
returns the taxon for the specified id along with all of its descendantslevel=number
return only taxons for the specified taxon level.valid=1
return only valid namesexternal=1
return the Tropicos, IPNI, MycoBank, ZOOBANK or GBIF reference numbers. You need to specify externalrefs
in the field list to return them!project=mixed
- id or name of project (may be a list) return the taxons belonging to one or more Projectsdataset=mixed
- id or name of a dataset (may be a list) return the taxons belonging to one or more Datasetslimit
and offset
are SQL statements to limit the amount. See Common parameters.
Notice that id
, name
and root
should not be combined.
Response fields
id
- this ODB id for this Taxon record in the taxons tablesenior_id
- if invalid this ODB identifier of the valid synonym for this taxon (acceptedNameUsage) - only when taxonomicStatus == ‘invalid’parent_id
- the id of the parent taxonauthor_id
- the id of the person that defined the taxon for unpublished names (having an author_id means the taxon is unpublished)scientificName
DWC - the full taxonomic name without authors (i.e. including genus name and epithet for species name)scientificNameID
DWC - nomenclatural databases ids, if any external reference is stored for this Taxon recordtaxonRank
DWC - the string value of the taxon ranklevel
- the ODB numeric value of the taxon rankscientificNameAuthorship
DWC - the taxon authorship. For taxonomicStatus unpublished: will be a ODB registered Person namenamePublishedIn
- unified bibliographic reference (i.e. either the short format or an extract of the bibtext reference assigned). This will be mostly retrieved from nomenclatural databases; Taxon linked references can be extracted with the BibReference endpoint.taxonomicStatus
DWC - one of ‘accepted’, ‘invalid’ or ‘unpublished’; if invalid, fields senior_id and acceptedNameUsage* will be filledparentNameUsage
DWC - the name of the parent taxon, if species, the genus, if genus, family, and so onfamily
DWC - the family name if taxonRank family or belowhigherClassification
DWC - the full taxonomic hierarchical classification, pipe separated (will include only Taxons registered in this database)acceptedNameUsage
DWC - if taxonomicStatus invalid the valid scientificName for this TaxonacceptedNameUsageID
DWC - if taxonomicStatus invalid the scientificNameID ids of the valid TaxontaxonRemarks
DWC - any note the taxon record may havebasisOfRecord
DWC - will always be ’taxon’externalrefs
- the Tropicos, IPNI, MycoBank, ZOOBANK or GBIF reference numbers
Traits Endpoint
The traits
endpoint interact with the Trait table. The basic usage is getting a list of variables and variables categories for importing Measurements.
GET request-parameters
id=list
return only traits having the id or ids provided (ex id=1,2,3,10
);name=string
return only traits having the export_name
as indicated (ex name=DBH
)categories
- if true return the categories for categorical traitslanguage=mixed
return name and descriptions of both trait and categories in the specified language. Values may be ’language_id’, ’language_code’ or ’language_name’;bibreference=boolean
- if true, include the BibReference associated with the trait in the results;limit
and offset
are SQL statements to limit the amount. See Common parameters.
Response fields
id
- the id of the Trait in the odbtraits table (a local database id)type
- the numeric code defining the Trait typetypename
- the name of the Trait typeexport_name
- the export name valuemeasurementType
DWC - same as export_name for DWC compatibilitymeasurementMethod
DWC - combine name, description and categories if apply (included in the Measurement GET API, for DWC compatibility)measurementUnit
- the unit of measurement for Quantitative traitsmeasurementTypeBibkeys
- the bibkeys of the bibliographic references associated with the trait definition, separated by pipe ‘|’taggedWith
- the name of the tags or keywords associated with the trait definition, separated by pipe ‘|’range_min
- the minimum allowed value for Quantitative traitsrange_max
- the maximum allowed value for Quantitative traitslink_type
- if Link type trait, the class of the object the trait links to (currently only Taxon)name
- the trait name in the language requested or in the default languagedescription
- the trait description in the language requested or in the default languagevalue_length
- the length of values allowed for Spectral trait typesobjects
- the types of object the trait may be used for, separated by pipe ‘|’categories
- each category is given for Categorical and Ordinal traits, with the following fields (the category id
, name
, description
and rank
). Ranks are meaningfull only for ORDINAL traits, but reported for all categorical traits.
Vernaculars Endpoint
The vernaculars
endpoints interact with the Vernacular table. Their basic usage is getting vernaculars or popular names for taxons.
GET parameters
id=list
return only vernaculars having the id or ids provided (ex id=1,2,3,10
)individual=mixed
either a individual_id or a list of ids, or fullnames or uuids;taxon=mixed
one of ids or scientificNames (ex id=1,2,3,10
)taxon_root=mixed
- same as taxon, but will include the descendants of the taxons informed. e.g taxon_root=Lauraceae
to get any Lauraceae vernacular;
Vouchers Endpoint
The vouchers
endpoints interact with the Voucher table. Their basic usage is getting data from Voucher specimens
GET parameters
id=list
return only vouchers having the id or ids provided (ex id=1,2,3,10
)number=string
returns only vouchers for the informed collector number (but is a string and may contain non-numeric codes)collector=mixed
one of id or ids or abbreviations, returns only vouchers for the informed main collectordataset=list
- one of id or ids list, name or names list, return all vouchers directly or indirectly related to the datasets informed.project=mixed
one of ids or names, returns only the vouchers for datasets belonging to the Project informed.location=mixed
one of ids or names; (1) if individual_tag
is also requested returns only vouchers for those individuals (or use “individual=*” to get all vouchers for any individual collected at the location); (2) if individual
and individual_tag
are not informed, then returns vouchers linked to locations and to the individuals at the locations.location_root=mixed
- same as location, but include also the vouchers for the descendants of the locations informed. e.g. “location_root=Manaus” to get any voucher collected within the Manaus administrative area;individual=mixed
either a individual_id or a list of ids, or *
- returns only vouchers for the informed individuals; when “individual=*” then location must be informed, see above;taxon=mixed
one of ids or names, returns only vouchers for the informed taxons. This could be either vouchers referred as parent of the requested taxon or vouchers of individuals of the requested taxons.taxon_root=mixed
- same as taxon, but will include in the return also the vouchers for the descendants of the taxons informed. e.g. “taxon_root=Lauraceae” to get any Lauraceae voucher;
Notice that some search fields (taxon, location, project and collector) may be specified as names - abbreviation, fullnames and emails in the case of collector - (eg, “taxon=Euterpe edulis”) or as database ids. If a list is specified for one of these fields, all items of the list must be of the same type.
Response fields
id
- the Voucher ODB id in the vouchers table (local database id)basisOfRecord
DWC - will be always ‘preservedSpecimen’ [dwc location](DWCoccurrenceID
DWC - a unique identifier for the Voucher record - combine organismID with biocollection infoorganismID
DWC - a unique identifier for the Individual the Voucher belongs toindividual_id
- the ODB id for the Individual the Voucher belongs tocollectionCode
DWC - the Biocollection acronym where the Voucher is depositedcatalogNumber
DWC - the Biocollection number or code for the VouchertypeStatus
DWC - if the Voucher represent a nomenclatural typerecordedBy
DWC - collectors pipe “|” separated list of registered Persons abbreviations that collected the vouchersrecordedByMain
- the first person in recordedBy, the main collectorrecordNumber
DWC - an identifier for the Voucher, generaly the Collector Number valuerecordedDate
DWC - the record date, collection datescientificName
DWC - the current taxonomic identification of the individual (no authors) or “unidentified”scientificNameAuthorship
DWC - the taxon authorship. For taxonomicStatus unpublished: will be a ODB registered Person namefamily
DWCgenus
DWCidentificationQualifier
DWC - identification name modifiers cf. aff. s.l., etc.identifiedBy
DWC - the Person identifying the scientificName of this recorddateIdentified
DWC - when the identification was made (may be incomplete, with 00 in the month and or day position)identificationRemarks
DWC - any notes associated with the identificationlocationName
- the location name for the organismID the voucher belongs to (if plot the plot name, if point the point name, …)higherGeography
DWC - the parent LocationName ‘|’ separated (e.g. Brasil | Amazonas | Rio Preto da Eva | Fazenda Esteio | Reserva km37);decimalLatitude
DWC - depends on the location adm_level and the individual X and Y, or Angle and Distance attributes, which are used to calculate these global coordinates for the record; if individual has multiple locations (a monitored bird), the location closest to the voucher date is obtaineddecimalLongitude
DWC - same as for decimalLatitudeoccurrenceRemarks
DWC - text note associated with this recordassociatedMedia
DWC - urls to ODB media files associated with the recorddatasetName
- the name of the ODB Dataset to which the record belongs to DWCaccessRights
- the ODB Dataset access privacy setting - DWCbibliographicCitation
- the ODB Dataset citation - DWClicense
- the ODB Dataset license - DWC
Jobs Endpoint
The jobs
endpoints interact with the UserJobs table. The basic usage is getting a list of submitted data import jobs, along with a status message and logs. You can also get data from jobs produced using the save_job=1
parameter, or export jobs created using the web interface (with the csv option only)
GET parameters
status=string
return only jobs for the specified status: “Submitted”, “Processing”, “Success”, “Failed” or “Cancelled”;id=list
- the job id or ids ;get_file
- if get_file=1
, then you can get the data file saved by the job. This needs also a single id
parameter. Useful, when getting data with the save_job=1
option.
Response fields
id
- the job idstatus
- the status of the jobdispatcher
- the type of the job, e.g, ImportTaxons;log
- the job log messages, usually indicating whether the resources were successfully imported, or whether errors occurred;
others.
Possible errors
This should be an extensive list of error codes that you can receive while using the API. If you receive any other error code, please file a bug report!
- Most of the time will be related to memory, if you are trying to get a large dataset, for example. See the get common parameters
- Error 401 - Unauthenticated. Currently not implemented. You may receive this error if you attempt to access some protected resources but didn’t provide an API token.
- Error 403 - Unauthorized. You may receive this error if you attempt to import or edit some protected resources, and either didn’t provide an API token or your user does not have enough privileges.
- Error 404 - The resource you attempted to see is not available. Note that you can receive this code if your user is not allowed to see a given resource.
- Error 413 - Request Entity Too Large. You may be attempting to send a very large import, in which case you might want to break it down in smaller pieces.
- Error 429 - Too many attempts. Wait one minute and try again.
- Error 500 - Internal server error. This indicates a problem with the server code. Please file a bug report with details of your request.
3 - POST data
How to import data into OpenDataBio!
The OpenDataBio R package is a client for this API.
Importing data from files through the web-interface require specifying the POST parameters here specified
Batch imports of Bibliographic References and MediaFiles are possible only through the web interface.
Authentication token is required for all POST
POST BibReferences
To import bibliographic references, two options with precedence over DOI:
doi
- the DOI number or URL of the reference to be registeredbibtex
- alternatively, a bibliographic record in the format bibtex
POST Biocollections
To import biocollection names:
name
- the full name of the biological collectionacronym
- the acronym or acronym of the biological collection
POST Individuals
Request fields allowed when importing individuals:
collector=mixed
- required - persons ‘id’, ‘abbreviation’, ‘full_name’, ’email’; if multiple persons, separate values in your list with pipe |
or ;
because commas may be present within names. Main collector is the first on the list;tag=string
- required - the individual number or code (if the individual identifier is as MainCollector+Number, this is the field for Number);dataset=mixed
- required - name or id of the Dataset;date=YYYY-MM-DD or array
- the date the individual was recorded/tagged, for historical records you may inform an incomplete string in the form “1888-05-NA” or “1888-NA-NA” when day and/or month are unknown. You may also inform as an array in the form “date={ ‘year’ : 1888, ‘month’: 5}”. OpenDataBio deals with incomplete dates, see the IncompleteDate Model. At least year
is required.notes
- any annotation for the Individual, plain text or data in JSON;
Location fields (one or multiple locations may be informed for the individual). Possible fields are:
location
- the Individual’s location name or id required if longitude and latitude are not informedlatitude
and longitude
- geographical coordinates in decimal degrees; required if location is not informedaltitude
- the Individual location elevation (altitude) in meters above see level. Must be a integer value;location_notes
- any note for the individual location, plain text or data in JSON;location_date_time
- if different than the individual’s date, a complete date or a date+time value for the individual first location. Mandatory for multiple locations;x
- if location is of Plot type, the x coordinate of the individual in the location;y
- if location is of Plot type, the y coordinate of the individual in the location;distance
- if location is of POINT type, the individual distance in meters from the location;angle
- if location is of POINT type, the individual azimuth (angle) from the location;
Identification fields. Identification is not mandatory, and may be informed in two different ways: (1) self identification - the individual may have its own identification; or (2), other identification - the identification is the same as that of another individual (for example, from an individual having a voucher in some biocollection).
- For (self) identification at least taxon and identifier must be informed. The list of possible fields are:
taxon=mixed
- name or id of the identified taxon, e.g. ‘Ocotea delicata’ or its ididentifier=mixed
- persons responsible for the taxonomic identification. persons ‘id’, ‘abbreviation’, ‘full_name’, ’email’; if multiple persons, separate values in your list with pipe |
or ;
because commas may be present within names.identification_date
or identification_date_year
, identification_date_month
, and/or identification_date_day
- complete or incomplete. If empty, the individual’s date is used;modifier
- name or number for the identification modifier. Possible values ’s.s.’=1, ’s.l.’=2, ‘cf.’=3, ‘aff.’=4, ‘vel aff.’=5, defaults to 0 (none).identification_notes
- any identification notes, plain text or data in JSON;identification_based_on_biocollection
- the biocollection name or id if the identification is based on a reference specimen deposited in an biocollectionidentification_based_on_biocollection_id
- only fill if identification_based_on_biocollection
is present;
- If the identification is other:
identification_individual
- id or fullname (organimsID) of the Individual having the identification.
If the Individual has Vouchers with the same Collectors, Date and CollectorNumber (Tag) as those of the Individual, the following fields and options allow to store the vouchers while importing the Individual record (alternatively, you may import voucher after importing individuals using the Voucher EndPoint. Vouchers for the individual may be informed in two ways:
- As separate string fields:
biocollection
- A string with a single value or a comma separated list of values. Values may be the id
or acronym
values of the Biocollection Model. Ex: “{ ‘biocollection’ : ‘INPA;MO;NY’}” or “{ ‘biocollection’ : ‘1,10,20’}”;biocollection_number
- A string with a single value or a comma separated list of values with the BiocollectionNumber for the Individual Voucher. If a list, then must have the same number of values as biocollection
;biocollection_type
- A string with a single numeric code value or a comma separated list of values for Nomenclatural Type for the Individual Vouchers. The default value is 0 (Not a Type). See nomenclatural types list.
- AS a single field
biocollection
containing an array with each element having the fields above for a single Biocollection:
“{
{ ‘biocollection_code’ : ‘INPA’, ‘biocollection_number’ : 59786, ‘biocollection_type’ : 0},
{ ‘biocollection_code’ : ‘MG’, ‘biocollection_number’ : 34567, ‘biocollection_type’ : 0}
}”
POST Individual-locations
The individual-locations
endpoint allows importing multiple locations for registered individuals. Designed for occurrences of organisms that move and have multiple locations.
Possible fields are:
individual
- the Individual’s id requiredlocation
- the Individual’s location name or id required OR longitude+latitudelatitude
and longitude
- geographical coordinates in decimal degrees; required if location is not informedaltitude
- the Individual location elevation (altitude) in meters above see level;location_notes
- any note for the individual location, plain text or data in JSON;location_date_time
- if different than the individual’s date, a complete date or a date+time (hh:mm:ss) value for the individual location. requiredx
- if location is of Plot type, the x coordinate of the individual in the location;y
- if location is of Plot type, the y coordinate of the individual in the location;distance
- if location is of POINT type (or latitude and longitude are informed), the individual distance in meters from the location;angle
- if location is of POINT type, the individual azimuth (angle) from the location
POST Locations
The locations
endpoints interact with the locations table. Use to import new locations.
Attention
ODB Locations are stored with a parent-child relationship, assuring validations and facilitating queries. Parents will be guessed using the location geometry. If parent is not informed, the imported location must be completely contained by a registered parent (using sql ST_WITHIN function to detect parent). However, if a parent is informed, the importation may also test if the geometry fits a buffered version of the parent geometry, thus ignoring minor geometries overlap and shared borders. Countries can be imported without parent relations. Any other location must be registered within at least a ‘country’ as parent. If the record is marine, and falls outside of a registered country polygon, a ‘ismarine’ argument must be indicated to accept the non-spatial parent relationship.
Subplots - a plot location within a plot location - is the only situation in which a geometry is not needed. If not informed, the geometry will be calculated based on the parent plot geometry and the subplot startx and starty coordinates.
Make sure your geometry projection is EPSG:4326 WGS84. Use this standard!
Available POST fields:
name
- the location name - required (parent+name must be unique in the database)adm_level
- must be numeric, see location get api - required- geometry use either: required
geom
for a WKT representation of the geometry, POLYGON, MULTIPOLYGON, POINT OR LINESTRING allowed;lat
and long
for latitude and longitude in decimal degrees (use negative numbers for south/west).
altitude
- in metersdatum
- defaults to ‘EPSG:4326-WGS 84’ and your are strongly encourage of importing only data in this projection. You may inform a different projection here;parent
- either the id or name of the parent location. The API will detect the parent based on the informed geometry and the detected parent has priority if informed is different. However, only when parent is informed, validation will also test whether your location falls within a buffered version of the informed parent, allowing to import locations that have a parent-child relationship but their borders overlap somehow (either shared borders or differences in georeferencing);- when location is plot (
adm_level=100
), optional fields are:x
and y
for the plot dimensions in meters(defines the Cartesian coordinates)startx
and starty
for start position of a subplot in relation to its parent plot location;
notes
- any note you wish to add to your location, plain text or data in JSON;azimuth
- apply only for Plots and Transects when registered with a POINT geometry - azimuth will be used to build the geometry. For plots the point coordinate refer to the 0,0 vertice of the plot polygon that will be build clockwise starting from the informed point, the azimuth and the y dimension. For transects, the informed point coordinates are the start point and a linestring will be build using this azimuth and x dimension.ismarine
- to permit the importation of location records that not fall within any register parent location you may add ismarine=1. Note, however, that this allows you to import misplaced locations. Only use if your location is really a marine location that fall outside any Country border;
alternatively: you may just submit a single column named geojson
containing a Feature record, with its geometry and having as ‘properties’ at least tags name
and adm_level
(or admin_level
). See geojson.org. This is usefull, for example, to import country political boundaries (https://osm-boundaries.com/).
POST Measurements
The measurements
endpoint allows to import measurements.
The following fields are allowed in a post API:
dataset=number
- the id of the dataset where the measurement should be placed requireddate=YYYY-MM-DD
- the observation date for the measurement, must be passed as YYYY-MM-DD requiredobject_type=string
- either ‘Individual’,‘Location’,‘Taxon’ or ‘Voucher’, i.e. the object from where the measurement was taken requiredobject_id=number
- the id of the measured object, either (individuals.id, locations.id, taxons.id, vouchers.id) requiredperson=mixed
persons responsible for the measurements. You may inform ‘id’, ‘abbreviation’, ‘full_name’ or ’email’. If multiple persons, separate values in your list with pipe |
or ;
because commas may be present within names. requiredtrait_id=number or string
- either the id or export_name for the measurement. requiredvalue=number, string list
- this will depend on the trait type, see tutorial required, optional for trait type LINKlink_id=number
- the id of the linked object for a Trait of type Link required if trait type is Link DEPRECATED REPLACED BY locationlocation or location_id
- the id or name of the Location of a measurement related to a Taxon. Only Taxons can also have a location associated with them. This replaces the Link-type Trait logic.bibreference=number
- the id of the BibReference for the measurement. Should be use when the measurement was taken from a publicationnotes
- any note you whish. In same cases this is a usefull place to store measurement related information. For example, when measuring 3 leaves of a voucher, you may indicate here to which leaf the measurement belongs, leaf1, leaf2, etc. allowing to link measurements from different traits by this field. Plain text or data in JSON;duplicated
- by default, the import API will prevent duplicated measurements for the same trait, object and date; specifying duplicated=#
, where # is the stored number of records+1. For example, there is already one record, you must inform duplicated=2
if there are two, a third can be stored using duplicated=3
.parent_measurement = number only
- the ‘id’ of another measurement which is the parent of the measurement being imported. This creates a relationship between these measurements. The ‘id’ will be validated and must be from a measurement belonging to the same object, same date and different variable. E.g. leaf width may be linked to a measurement of leaf length.
POST Media
The media
endpoint interacts with the Media table, and the import process works the same way as batch uploading via the web interface.
The API should receive a ZIP file containing the images to be imported, along with one CSV file, which may include the following attributes for each image:
filename
– required: the exact name of the image fileobject_type
– required: must be one of the following values: ['Individual', 'Voucher', 'Location', 'Taxon']
object_id
– required: the numeric ID of the object_type
related to the imagecollector
– a list of registered collector numbers or names who will be considered the authors of the image; can be persons.id
, abbreviation
, full_name
, or email
. If multiple people are listed, separate values with a vertical bar |
or semicolon ;
(since names may contain commas).tags
– a list of numeric IDs or names of Tags, i.e., keywords describing the image content; separated by ;
or |
date
– the date of the image in YYYY-MM-DD
format; if not provided, the import date will be usedtitle_en
and/or title_pt
– one or more columns with the title of the image in the registered languageslicense
– one of the following public licenses from CreativeCommons.org:
['CC0', 'CC-BY', 'CC-BY-SA', 'CC-BY-ND', 'CC-BY-NC', 'CC-BY-NC-SA', 'CC-BY-NC-ND']
If not specified, the default will be CC-BY-SA
dataset
– the name (acronym) or ID of the dataset to which the media will be linked — the media access permissions will match those of the datasetproject
– the name (acronym) or ID of the project to associate with the medianotes
– any general note about the file contentlocation
– the ID or name of the Location to link the media to — for media linked to Taxon
, you can alternatively use latitude
and longitude
longitude
– longitude in decimal degrees (negative for West) — for media linked to Taxon
latitude
– latitude in decimal degrees (negative for South) — for media linked to Taxon
POST Persons
The persons
endpoint interact with the Person table. The following fields are allowed when importing persons using the post API:
full_name
- person full name, requiredabbreviation
- abbreviated name, as used by the person in publications, as collector, etc. (if left blank, a standard abbreviation will be generated using the full_name attribute – abbreviation must be unique within a ODB installation);email
- an email address,institution
- to which institution this person is associated;biocollection
- name or acronym of the Biocollection to which this person is associated.
POST Taxons
Use to import new taxon names.
The POST API requires ONLY the full name of the taxon to be imported, i.e. for species or below species taxons the complete name must be informed (e.g. Ocotea guianensis or Licaria cannela aremeniaca). The script will validate the name retrieving the remaining required info from the nomenclatural databases using their API services. It will search GBIF and Tropicos if the case and retrieve taxon info, their ids in these repositories and also the full classification path and senior synonyms (if the case) up to when it finds a valid record name in this ODB database. So, unless you are trying to import unpublished names, just submit the name parameter of the list below.
Possible fields:
name
- taxon full name required, e.g. “Ocotea floribunda” or “Pagamea plicata glabrescens”level
- may be the numeric id or a string describing the taxonRank recommended for unpublished namesparent
- the taxon’s parent full name or id - note - if you inform a valid parent and the system detects a different parent through the API to the nomenclatural databases, preference will be given to the informed parent; required for unpublished namesbibreference
- a textual reference in which the taxon was published;bibkey
- a registered BibReference - either the numeric id
or the bibkey
author
- the taxon author’s name;author_id
or person
- the registered Person name, abbreviation, email or id, representing the author of unpublished names - required for unpublished namesvalid
- boolean, true if this taxon name is valid; 0 or 1mobot
- Tropicos.org id for this taxonipni
- IPNI id for this taxonmycobank
- MycoBank id for this taxonzoobank
- ZOOBANK id for this taxongbif
- GBIF nubKey for this taxon
POST Traits
When entering few traits, it is strongly recommended that you enter traits one by one using the Web Interface form, which reduces the chance of duplicating trait definitions.
The traits
endpoint interact with the Trait table. The POST method allows you to batch import traits into the database and is designed for transferring data to OpenDataBio from other systems, including Trait Ontologies.
- As noted under the Trait Model description, it is important that one really checks whether a needed Trait is not already in the DataBase to avoid multiplication of redundant traits. The Web Interface facilitates this process. Through the API, OpenDataBio only checks for identical
export_name
, which must be unique within the database. Note, however, that Traits should also be as specific as possible for detailed metadata annotations. - Traits use User Translations for names and descriptions, allowing a multiple-languages
Fields allowed for the traits/ post API:
export_name=string
- a short name for the Trait, which will be used during data exports, are more easily used in trait selection inputs in the web-interface and also during data analyses outside OpenDataBio. Export names must be unique and have no translation. Short and CamelCase export names are recommended. Avoid diacritics (accents), special characters, dots and even white-spaces. requiredtype=number
- a numeric code specifying the trait type. See the Trait Model for a full list. requiredobjects=list
- a list of the Core objects the trait is allowed to be measured for. Possible values are ‘Individual’, ‘Voucher’, ‘Location’ and/or ‘Taxon’, singular and case sensitive. Ex: “{‘object’: ‘Individual,Voucher’}”; requiredname=json
- see translations below; requireddescription=json
- see translations below; required- Trait specific fields:
unit=string
- required for quantitative traits only (the unit o measurement). This must be either a code or a name (in any language) of a unit already stored in the database. Units can only be define through the web interface.range_min=number
- optional for quantitative traits. specify the minimum value allowed for a Measurement.range_max=number
- optional for quantitative. maximum allowed value for the trait.categories=json
- required for categorical and ordinal traits; see translations belowwavenumber_min
and wavenumber_max
- required for spectral traits = minimum and maximum WaveNumber within which the ‘value_length’ absorbance or reflectance values are equally distributed. May be informed in range_min
and range_max
, priority for prefix wavenumber over range if both informed.value_length
- required for spectral traits = number of values in spectrumlink_type
- required for Link traits - the class of link type, fullname or basename: eg. ‘Taxon’ or ‘App\Models\Taxon’.
bibreference=mix
- the id(s) or bibkey(s) of a BibReference already stored in the database, separated by ‘|’ or ‘;’parent
- id or export_name of another Trait to which the current trait depends on. If you indicate a trait here, this means you add a RESTRICTION on the validation of the measurements. Adding a Measurement for the current trait will DEPEND on the database having a measurement for the trait here indicated, for the same object and same date. Example, you create a trait called POM (point of measurement) for recording the height on a tree where you measure a DBH (diameter at breast height). Adding DBH as a trait on which POM depends upon, means you can only add POM if there is a DBH value for the same tree on the same date.
Translations
Fields name
, description
must have the following structure to account for User Translations. They should be a list with the language as ‘keys’. For example a name
field may be informed as:
- using the Language code as keys:
[
{"en": "Diâmetro na altura do peito"," pt-br": "Diâmetro a Altura do Peito"}
]
- or using the Language ids as keys:
[
{"1":"Diâmetro à altura do peito","2":"Diâmetro a Altura do Peito"}
]
- or using the Language names as keys:
[
{"English":"Diameter at Breast Height","Portuguese": "Diâmetro a Altura do Peito"}
]
Alternatively, you can add the information as separate parameters. Instead of name
you can use name.LANGUAGE_CODIGO_ou_ID
, for example name.en
or name.1
for the name in English and name.pt-br
or name.2
for the name in Portuguese. Likewise for description
: description.en
or description.1
, etc.
Field categories
must include for each category+rank+lang the following fields:
lang=mixed
- the id, code or name of the language of the translation, requiredname=string
- the translated category name required (name+rank+lang must be unique)rank=number
- the rank for ordinal traits; for non-ordinal, rank is important to indicate the same category across languages, so may just use 1 to number of categories in the order you want. requireddescription=string
- optional for categories, a definition of the category.- Example for categories:
[
{"lang":"en","rank":1,"name":"small","description":"smaller than 1 cm"},
{"lang":"pt-br","rank":1,"name":"pequeno","description":"menor que 1 cm"}
{"lang":"en","rank":1,"name":"big","description":"bigger than 10 cm"},
{"lang":"pt-br","rank":1,"name":"grande","description":"maior que 10 cm"},
]
Valid languages may be retrieved with the Language API.
POST Vernaculars
The vernaculars
endpoint interacts with the Vernacular table, which contains information on common names to be related to Taxon and/or Individual records.
The following fields are allowed in the data import:
name
- required - the common name to be recorded;language
- required - the name, code or id of the language related to the common name. See languages endpointtaxons = list
- scientific names or ids of taxons. See taxons endpointindividuals = list
- fullnames, ids or uuids of individuals. See individuals endpointcitations = list
- one or more bibliographic citations, which may have the following fields:citation = string
- the text of the citationbibreference = mixed
- the id or bibkey of the bibliographic reference that must be previously registered See bibreferences endpointnotes
- any annotationparent
- the id or name of another Vernacular to inform variants of popular namestype
- one of ‘use’ or ‘generic’ or ’etimology’
POST Vouchers
The vouchers
endpoint interact with the Voucher table.
The following fields are allowed in a post API:
individual=mixed
- the numeric id or organismID of the Individual the Voucher belongs to required;biocollection=mixed
- the id, name or acronym of a registered Biocollection the Voucher belongs to required;biocollection_type=mixed
- the name or numeric code representing the kind of nomenclature type the Voucher represents in the Biocollection. If not informed, defaults to 0 = ‘Not a Type’. See nomenclature types for a full list of options;biocollection_number=mixed
- the alpha numeric code of the voucher in the biocollection;number=string
- the main collector number -only if different from the tag value of the Individual the voucher belongs to;collector=mixed
- either ids or abbreviations of persons. When multiple values are informed the first is the main collector. Only if different from the Individual collectors list;date=YYYY-MM-DD or array
- needed only if, with collector and number, different from Individual values. Date may be an IncompleteDate Model.dataset=number
- inherits the project the Individual belongs too, but you may provide a different project if needednotes=string
- any text note to add to the voucher, plain text or data in JSON;
Notes field
The notes
field of any model is for plain text or text formatted as a JSON object containing structured data. The Json option allows you to store custom structured data in any model that has the notes
field. You can, for example, store some secondary fields from original sources as notes when importing data, but you can store any additional data that is not provided by the OpenDataBio database framework. This data will not be validated nor searchable by OpenDataBio and the standardization of tags and values is up to you. Json notes will be imported and exported as JSON text and will be presented in the interface as a formatted table; URLs in your Json will be presented as links in this table.
4 - Update Data - PUT
How to update data in OpenDataBio using the API
Attention
Only the endpoints listed below can be updated using the API, and only the listed PUT fields can be updated for each endpoint. Field values are the same as those described for the POST API. In all cases, the numeric identifier (id
or {model}_id
) of the record to be updated must be provided.Endpoint | Description | PUT Fields |
---|
individuals | Update Individuals | (id or individual_id ), collector , tag , dataset , date , notes , taxon , identifier , identification_date , modifier , identification_notes , identification_based_on_biocollection , identification_based_on_biocollection_id , identification_individual |
individual-locations | Update Individual Locations | (id or individual_location_id ), individual , (location or latitude + longitude ), altitude , location_notes , location_date_time , x , y , distance , angle |
locations | Update Locations | (id or location_id ), name , adm_level , (geom or lat + long ), parent , altitude , datum , x , y , startx , starty , notes , ismarine |
measurements | Update Measurements | (id or measurement_id ), dataset , date , object_type , person , trait_id , value , link_id , bibreference , notes , duplicated , parent_measurement |
media | Update Media Metadata | (id or media_id or media_uuid ), collector , tags , date , title_en , title_pt , license , dataset , project , notes , (location or longitude + latitude ) |
persons | Update Persons | (id or person_id ), full_name , abbreviation , email , institution , biocollection |
vouchers | Update Vouchers | (id or voucher_id ), individual , biocollection , biocollection_type , biocollection_number , number , collector , date , dataset , notes |