gbif / vocabulary

A simple registry of controlled vocabularies used for terms found in GBIF mediated data.
Apache License 2.0
6 stars 1 forks source link

Include labels in suggest endpoint #102

Closed MortenHofft closed 2 years ago

MortenHofft commented 2 years ago

The current suggest endpoint has little value from a UI perspective (instead we use the search endpoint) https://api.gbif.org/v1/vocabularies/EstablishmentMeans/concepts/suggest?limit=100&q=i

it allows you to search by ID and returns only the IDs. Users expect to see and search by the label.

search not ideal Example: the label for introduced is Introduced (Alien, Exotic, Non-native, Nonindigenous). https://api.gbif.org/v1/vocabularies/EstablishmentMeans/concepts/introduced

It is natural to assume that I can search for alien, but that will give no results.

result format no ideal And even if it did, then I would have to do a lookup once per entry to get the label in the correct language.

Suggestion https://api.gbif.org/v1/vocabularies/EstablishmentMeans/concepts/suggest?limit=100&q=alien

should return something like

[
{
"name": "introduced",
"label": {
  "en": "Introduced (Alien, Exotic, Non-native, Nonindigenous)",
  "es-ES": "Introducida"
}
]

and an option to restrict to a locale https://api.gbif.org/v1/vocabularies/EstablishmentMeans/concepts/suggest?limit=100&q=intro&locale=es-ES // searching for alien would then return no results

[
{
"name": "introduced",
"label": {
  "es-ES": "Introducida"
},
]
marcos-lg commented 2 years ago

Deployed to PROD