Observation Fields¶
Summary¶
Classes
Functions
Delete an observation field value from an observation |
|
|
Create or update an observation field value on an observation |
Module Contents¶
- pyinaturalist.v1.observation_fields.delete_observation_field(observation_field_value_id, **params)¶
Delete an observation field value from an observation
Notes
API reference: DELETE /observation_field_values/{id}
Example
>>> # Observation field value IDs can be found on observation records: >>> response = get_observation(70963477) >>> ofv_ids = [ofv['id'] for ofv in response['ofvs']]
>>> for ofv_id in ofv_ids: ... delete_observation_field(ofv_id)
- pyinaturalist.v1.observation_fields.set_observation_field(observation_id, observation_field_id, value, **params)¶
Create or update an observation field value on an observation
Notes
API reference: POST /observation_field_values/{id}
To find an
observation_field_id
, either userget_observation_fields()
or search observation fields on iNaturalist
- Parameters:
observation_id (
int
) – ID of the observation receiving this observation field valueobservation_field_id (
int
) – ID of the observation field for this observation field valuevalue (
Any
) – Value for the observation fieldaccess_token (
Optional
[str
]) – An access token for user authentication, as returned byget_access_token()
dry_run (
Optional
[bool
]) – Just log the request instead of sending a real requestsession (
Optional
[Session
]) – An existing Session object to use instead of creating a new one
Example
>>> # First find an observation field by name, if the ID is unknown: >>> response = get_observation_fields('vespawatch_id') >>> observation_field_id = response[0]['id']
>>> set_observation_field( ... 7345179, ... observation_field_id, ... value=250, ... access_token=token, ... )
{ "id": 31, "observation_id": 18166477, "observation_field_id": 31, "value": "fouraging", "created_at": "2012-09-29T11:05:44.935+02:00", "updated_at": "2018-11-13T10:49:47.985+01:00", "user_id": 1, "updater_id": 1263313, "uuid": "b404b654-1bf0-4299-9288-52eeda7ac0db", "created_at_utc": "2012-09-29T09:05:44.935Z", "updated_at_utc": "2018-11-13T09:49:47.985Z" }