Search observations using URLs by several conditions with an 'AND' operator instead of 'OR'

When I use the URL method to search for observations with two or more conditions in the annotation fields it yields results considering an ‘OR’ operator. But I’m interested in observations that meets several criteria at the same time. For example juvenile birds that are dead.
Here is an example: &term_id=1,17&term_value_id=8,19 for birds, I get either observations meeting one or the other criteria. How can I find juvenile birds that are dead? Thanks for any comments!


I’m not an expert at this, but I believe different criteria params do a logical ‘AND’. If they are a list, or the same criteria it is an implicit ‘OR’. I believe what’s happening here is that these two criteria are expected to be used together and so being treated as an ‘OR’. See:

You may want to try using the exclusion criteria ( &without_term_id=) to eliminate the ones you don’t want. Logically that should work with an ‘OR’.

Lots more info on using URL params here:

Thank you so much @iorek for your reply. That was indeed a useful feature that I hadn’t notice. It has helped me for example to exclude adults birds (to narrow down the search to observations of juveniles), but unfortunately not all observations had this tag added. Still, if there were an “AND” operator, would be the best solution for this kind of search. Or could there be a workaround using the “without_term” parameters? Thanks!

1 Like

After doing a little experimentation, it appears the term_id/term_value_id operators perform an inclusive OR. So for your example url, they match all of these: Only Dead; Only Juvenile; Both Dead / Juvenile. The without operators also perform an inclusive OR, but an AND is performed between the two operator types. This almost allows you to achieve what you want, except for one crucial feature: there seems to be no way to explicitly specify the null case (i.e. observations with no annotation at all). If this feature was present, you could do something like this (which currently doesn’t work):

  • &term_id=1,17&term_value_id=8,19&without_term_id=1,17&without_term_value_id=0,2,7,18,20

where I’m using 0 to represent the null case. So the intended effect of this would be to exclude all observations having either the annotations Adult, Egg, Alive, Cannot Be Determined, or no Life Stage or Alive/Dead annotation at all. This last condition is what would filter out the Only Dead or Only Juvenile matches mentioned above.

Thanks @bazwal for your explanation and taking the time to check my question. Certainly the feature you propose would do the trick!

if get the results from your one-or-the-other query, including annotation values, then you can parse those results and keep only the ones that have both annotation values. some discussion on how to get annotation values from the API here:

a variation of this would be to get the smaller set of records (probably dead birds) and then inspect the annotation values of each of the records in that set, keeping a record if it includes the other annotation value (juvenile) as well.

other possible methods involve essentially joining the results of two queries. it’s probably easiest to accomplish this using the API, or possibly via CSV exports, rather than going through the regular Explore page.

method 3:

  1. get list of obs ids for juvenile birds
  2. get list of obs ids for dead birds
  3. outside of the system, compare the results of the two lists and get only ids that exist in both lists

method 4:

  1. get list of obs ids for the smaller set (probably dead birds)
  2. get list of obs ids for the other set (probably juvenile birds), with an additional &id= parameter set to the list of observations from the first part.

for an example of how to get a list of observation ids from the API, see

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.