We found a bug in the new taxon_id
support in the /v1/taxa/autocomplete
endpoint. Here’s a test URL, specifying taxon_id=7823
(Corvidae) and q=fish
:
https://api.inaturalist.org/v1/taxa/autocomplete?q=fish&taxon_id=7823
Surprisingly, this returns 2 records, the first of which does not include 7823
in the ancestor_ids
and the second of which does.
- Actinopterygii (Ray-finned Fishes) with
"ancestor_ids":[48460,1,2,355675,47178]
- Corvus ossifragus (Fish Crow) with
"ancestor_ids":[48460,1,2,355675,3,7251,7823,7998,8001]
Compare the results with the return from the /v1/taxa
endpoint for the same query:
https://api.inaturalist.org/v1/taxa?q=fish&taxon_id=7823
This correctly only matches the 2nd record above, the “Fish crow” record.
As a workaround, I will iterate over the returned records and return the first one that contains the ancestor taxon_id
in ancestor_ids
.
Please look into this & fix.
Thanks,
Ben