Query API using an observation field with a name that contain "&"

My first question :)

I can query a field called “SA Veg: Fynbos Types”:
https://www.inaturalist.org/observation_fields/7867
By name:
https://api.inaturalist.org/v1/observations?&project_id=21467&place_id=6986&photos=true&page=1&per_page=20&field:SA+Veg:+Fynbos+Types

but a field called “SA Veg: Albany Thicket & Strandveld Types”
https://www.inaturalist.org/observation_fields/7863
By name:
https://api.inaturalist.org/v1/observations?&project_id=21467&place_id=6986&photos=true&page=1&per_page=20&field:SA+Veg:+Albany+Thicket+&+Strandveld+Type
dont return anything.

I suspect it is about escaping the “&”, which I tried but without luck.
https://api.inaturalist.org/v1/observations?&project_id=21467&place_id=6986&photos=true&page=1&per_page=20&field:SA+Veg:+Albany+Thicket+&+Strandveld+Type
https://api.inaturalist.org/v1/observations?&project_id=21467&place_id=6986&photos=true&page=1&per_page=20&field:SA+Veg:+Albany+Thicket+%26+Strandveld+Type

What is the correct escape character to use? (If it is possible)

Alternatively, is there a way to use the field id rather, something like:
(Note these 3 examples does return values, because my attempted query parameter does not exists aand is ignored)
https://api.inaturalist.org/v1/observations?&project_id=21467&place_id=6986&photos=true&page=1&per_page=20&field:7863
https://api.inaturalist.org/v1/observations?&project_id=21467&place_id=6986&photos=true&page=1&per_page=20&fieldid:7863
https://api.inaturalist.org/v1/observations?&project_id=21467&place_id=6986&photos=true&page=1&per_page=20&field_id:7863

When I look at:
https://api.inaturalist.org/v1/docs/#!/Observations/get_observations
I see the “ofv_datatype” parameter - but that does not work with either teh field name or id

i.e. same as what is happening on this page:
https://www.inaturalist.org/observation_fields/7863?utf8=✓&value=any

but pulling that data from the API

https://api.inaturalist.org/v1/observations?field:SA%20Veg%3A%20Albany%20Thicket%20%26%20Strandveld%20Types

see:

1 Like

Brilliant, much appreciated

image

Just for the record, that encoding is not honored in the web GUI (that was my starting point originally ) returning no results.

Shall I log a separate bug somewhere? (Not that I personally need that currently now)

it’s already logged in the second thread noted above.

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