This function will add observations of species (or lack thereof) to files on the ARISE MDS server and at the appropriate file object in the database.
There are three ways of finding the appropriate files. One must be included. These can be a single item or a list. If providing a list, the observations will be linked to all of those files.
fileid : Integer. ID of file in database.
filename : Name of file in database. Note that this does not include the extension.
originalname : Original name of file, as stored in the "originalname" field in the database.
datetime : not required, but recommended Time of observation preferably in the format %Y-%m-%d %H:%M:%S.%f %Z %z (fractional seconds and timezone optional). If no datetime is provided, this will be taken from the recording time of the first file linked to the observation.
observation : required Scientific name of species or a blank ("") in the case of the observation being of nothing
number: defaults to 1 Count of the observed species.
source : required Source of the observation, e.g. human or the name and version of the algorithm used.
extradata:not required Any additional information about the observation in JSON format.
api_url = "https://arisemdsvm.science.uva.nl//api-token-auth/"
response = requests.post(api_url,{"username":username,"password":password})
token=response.json()['token']
#Assign files to a specific deployment
api_url = "https://arisemdsvm.science.uva.nl//api/AddObservation/"
response = requests.post(api_url,
headers={'Authorization': 'token {}'.format(token)},
data={
"fileid":[21096,21091],#linking to multiple files.
"datetime":"2023-01-01 10:47:45",
"observation":"SEAGULL",
"source":"MY EYES",
"extradata":json.dumps({"flying":True})
})
print(response.json())