v2 seems to have some sort of validation mechanism to make sure user-input parameter values match allowable values (as defined in Swagger?). generally, that seems like a good thing, except that the allowable value definitions seem to not match what has actually been allowed in the past in some cases – specifically for what we would normally think of as binary parameters.
for example, here’s how verifiable is defined in GET /observations:
v1:
v2:
conceptually, this accurately reflects the binary nature of the parameter, except that historically, v1 has also accepted any as a valid input for true/false parameters. (=any would return both =true and =false values.)
but compare the following results. v1 returns all observations, while v2 returns an error:
-
GEThttps://api.inaturalist.org/v1/observations?verifiable=any&per_page=0 :
{"total_results":363638330,"page":1,"per_page":0,"results":[]} -
GEThttps://api.inaturalist.org/v2/observations?verifiable=any&per_page=0 :
{"status":422,"errors":[{"path":"verifiable","message":"must be equal to one of the allowed values","instancePath":"/verifiable","params":{"allowedValues":["true","false"]}}]}
since the default when verifiable is not used is effectively verifiable=any, one might be tempted to say that you could just exclude verifiable=any altogether. however:
-
even when you can just exclude altogether, it can be inconvenient. for example, suppose you have start with this URL for the Explore page: https://www.inaturalist.org/observations?verifiable=any&user_id=pisum. historically, you could have copied the parameters from that URL and used those directly in an API request URL:
GEThttps://api.inaturalist.org/v1/observations?verifiable=any&user_id=pisum. but sincev2won’t acceptverifiable=any, you’d have to do extra work to remove the parameter when creating a request URL forv2:GEThttps://api.inaturalist.org/v2/observations?usser_id=pisum. -
not every parameter effectively defaults to
=anyas the default when it’s not used. for example,GET /taxaeffectively defaults toGET /taxa?is_active=true. this means that inv1, the way to get all taxa (both active and inactive) is toGEThttps://api.inaturalist.org/v1/taxa?is_active=any, but you get an error if you try that inv2:GEThttps://api.inaturalist.org/v2/taxa?is_active=any. so right now, you’d have toGEThttps://api.inaturalist.org/v2/taxa?is_active=true andGEThttps://api.inaturalist.org/v2/taxa?is_active=false, and then merge the results.
so to get back the same sort of functionality that was available in v1, maybe the definitions (at least for v2) for binary parameters need to be updated to include an any option.

