How to use iNaturalist's Search URLs - wiki part 1 of 2

Would you give us an example of a search with taxon_name which returns results from other taxa? I wasn’t able to find any which behave that way in a few minutes of messing around, so it sounds like there might be some specific trigger.

If you take your Bouteloua curtipendula URL above, and change it to Bouteloua curtipendulus, it returns all iNaturalist observations of all taxa.

1 Like

Ah, I get it now. Thanks for the clarification. I focused too much on the “complex queries” part, thinking it meant that adding a bunch of other parameters like place, time, and person caused the search to return wrong results.

1 Like

Thanks for jumping in while I was away from the computer @jdmore

Here are two examples using a more complex query.

This one works:

https://www.inaturalist.org/observations?taxon_name=Aristotelia+peduncularis&project_id=vascular-flora-of-tasmania&ident_user_id=mftasp,mattintas

This one does not, and instead returns all records that fulfil the rest of the criteria:

https://www.inaturalist.org/observations?taxon_name=Gunnera+cordifolia&project_id=vascular-flora-of-tasmania&ident_user_id=mftasp,mattintas

1 Like

@mftasp after some more experimenting, I added more information to the wiki section regarding synonyms and common names. These will work using the same search parameter. But if they are not unique in iNaturalist (e.g., used for more than one taxon), it will only return results for one of the taxa.

1 Like

Love this, great information. I was trying to figure out how to add observation tag values to search strings, which is super useful. However, I noticed that when the tag is a taxon tag (e.g., Host Plant ID), results are returned only for exact matches and do not including daughter taxa. This makes sense, but in some cases it would be even more useful if I could, for example, get results with a tag containing a genus OR any species in that genus. For example, https://www.inaturalist.org/observations?project_id=33779&field:Host%20Plant%20ID=53854 returns observations in Leafminers of North America that have the tag Host Plant ID = Ilex, but not those with Host Plant ID = Ilex opaca (or any other Ilex identified beyond genus). Would be nice if it could do the latter as well. Also, looks like it doesn’t allow you to search multiple taxon ids at once by concatenating with a comma.

1 Like

Has anything about how this works changed recently? I’m trying to set up a search string to show all the observations in a project that aren’t mine. What I put together is https://www.inaturalist.org/observations?project_id=61767&not_user_id=er1kksen

When I search this, I just get the spinning “searching” arrows in perpetuity. When I change it to just &user_id , no problem. Substituting other user IDs produces the same result. I tried the same thing from my phone without being logged in and still got the same result.

To follow up a little more I set up a search that would exclude all observations in that project that are NOT within chautauqua county, NY- should get zero results as the whole project area is in that county. Instead I get the exact same results from &not_place_id=693 as using &place_id=693.

not_user_id requires the numerical user id, not the string. If you go to your profile page and add .json to the end of the URL, the first number is the user id – for you it’s 192963, so the working search is https://www.inaturalist.org/observations?project_id=61767&not_user_id=192963.

The correct place exclusion search term is not_in_place (rather than not_place_id), so the working search URL is https://www.inaturalist.org/observations?project_id=61767&not_in_place=693.

5 Likes

Ah, thanks. I guess since my actual username (which I guess is a “string”?) worked for the positive query it didn’t occur to me it wouldn’t work the same for a negative one. The place filter I apparently just fumbled entirely.

4 Likes

Yeah, I’m not totally sure why they’re implemented differently. I added a small note up top to hopefully clarify that going forward.

3 Likes

I am unable to find all NYC White Snakeroot (Ageratina altissima) observations that do NOT have a value for observation field Leaf Miner

I tried many of the very useful tips shared here (thank you all, especially Tony Iwane).

I can find those with observation field Leaf Miner = any value
https://www.inaturalist.org/observations?verifiable=any&taxon_id=119048&place_id=674&field:Leaf%20Miner

Here are the strings I tried so far to find where observation field Leaf Miner is null:

&not_field:Leaf%20Miner
&without_field:Leaf%20Miner
&field:not_Leaf%20Miner
&field:without_Leaf%20Miner
&without_field:Leaf%20Miner
&without_field_Leaf%20Miner
&not_field_Leaf%20Miner

And all of the above with and without Leaf%20Miner=yes,no,unclear

Thank you for any tips.

1 Like

Feel free to vote for the feature request.

1 Like

hey, welcome to the forum! :)

Thank you! I voted. There are now 8 votes.

I’m not entirely sure this is the place to post this, since I’m not seeing any prior mention of &unobserved_by_user_id=

However, when I use it, I do get species showing up that I have observed, for example here:
https://www.inaturalist.org/observations?place_id=118376&subview=grid&unobserved_by_user_id=gwark&view=species

I (gwark) have multiple observations of Trichoderma - is this showing up because it’s only excluding species that have been observed by me?

1 Like

The unobserved_by_user_id parameter should be used in combination with rank=species, or hrank=species to get accurate species-level results

3 Likes

Thanks - that’s helpful to know.

I’m still curious why results from me would be showing up at the genus level (for example, if I set rank=genus - for example, the Trichoderma observations show up. Is this an intended thing that I’m misunderstanding?

No - again this filter should be used with rank species to avoid getting genus results. Perhaps the API should be doing that itself. This is a parameter that probably should not have been documented in the API and perhaps should be removed. It is only used for one very niche feature in the Android app that probably doesn’t get much use - and since we don’t use it ourselves it doesn’t get the quality control other API parameters do.

2 Likes

Thanks - I appreciate the follow up. It’s helpful to know that it’s only intended to work for species.

For what it’s worth I like having access to this parameter, as it makes it much easier for me to find species to target in my area which I’ve not already seen (and where I’m at, most of the observed species are ones I’ve already observed - so there’s a lot to try and sort through otherwise).

That said, perhaps there’s a different or more recommended approach for getting a list of ‘not observed’ species for a given area which I don’t know about/

Is there a way to use taxon_name to search for a genus name that is reused in multiple kingdoms? E.g. genus Stellaria appears under both animals and plants. Without knowing the taxon_id, can I restrict the search to just plants? Otherwise the search fails and returns all taxons.

Thanks.

3 Likes