Back to help overview
Back to API functionality

File list API

List and update datafiles

This function will list datafile to which you have permission in the ARISE MDS server.

Fields

Parameters can be provided

Parameter fields

filename: Lists file with the exact filename as provided character string (note, no extension)

filename__contains: Lists files with character string contained in their filename (note, no extension)

filename__in: Lists files with filename in provided character string

format: Lists files with extension as in provided character string

format__in: Lists files with extension as in provided character string

datatype: Lists files with the datatype as in provided character string

datatype__in: Lists files with the datatype database ID as in provided string

deployment: Lists files with the deployment deploymentdeviceID as the provided character string

deployment__in:Lists files with the deployment database ID as in provided string

originalname: Lists file with the exact originalname as provided character string.

originalname__in: Lists files with originalname in provided character string

start_date: Lists files with a recordingdate greater than or equal to the provided date (format YYYY-mm-dd)

end_date: Lists files with a recordingdate less than or equal to the provided date (format YYYY-mm-dd)

created_after: Lists files added to the database greater than or equal to the provided date (format YYYY-mm-dd)

created_before: Lists files added to the database less than or equal to the provided date (format YYYY-mm-dd)

filesizegt: Lists files with a size (in bytes) greater than the provided integer.

filesizelt: Lists files with a size (in bytes) less than the provided integer.

hasobs: If set to True, will only list files with attached observations.

tarfile: Lists files attached to the provided tarfile.

extrainfo: Allows the listing of files based on extrainfo. Query is made using a character string containing keys and a value separated by "". The final character string after the last "" is assumed to be the value, all other preceding strings are assumed to be keys. For example, if a datafile has the following extrainfo:

{
"foo":{
    "bar":"test"
    }
}

the string provided to obtain this file would be "foo__bar__test"

Code examples

Python

api_url = "http://arisemdsvm.science.uva.nl/api-token-auth/"         
response = requests.post(api_url,{"username":username,"password":password})
token=response.json()['token']


#query based on existence of originalnames
api_url =  "https://arisemdsvm.science.uva.nl//api/File/"
#Get files based on a query
response = requests.get(api_url,
                         headers={'Authorization': 'token {}'.format(token)},
                         params={"originalname__in":",".join(["SY2103000161-SYFR0042.JPG","SY2103000161-SYFR0043.JPG"])}
                         )
print(response.json())

#query based on extrainfo
api_url =  "https://arisemdsvm.science.uva.nl//api/File/"
#Get files based on a query
response = requests.get(api_url,
                         headers={'Authorization': 'token {}'.format(token)},
                         params={"extrainfo":"test__foo"}
                         )
print(response.json())

#query based on date
api_url =  "https://arisemdsvm.science.uva.nl//api/File/"
#Get files based on a query
response = requests.get(api_url,
                         headers={'Authorization': 'token {}'.format(token)},
                         params={"start_date":"2023-01-01"}
                         )
print(response.json())

Details

URL : api/File/

Method : GET

Auth required : YES

Permissions required : None for GET.

```