Back to help overview
Back to API functionality

File check API

Check a device/deployment for existing filenames

This function will check if a file already exists and is attached to particular device/deployment using a file's originalname. It will return a list of files that are NOT yet on the server

Fields

Requires data.

Data fields

device : Required if deployment or device token is not supplied. devicelabel of a device in the database.

deployment : Required if device or device token is not supplied. deploymentdeviceID of a deployment in the database.

originalnames : Required. List of originalnames (including extension) to be checked.

Code examples

Python

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

#Check a specific deployment
api_url = "http://arisemds.science.uva.nl/api/FileUploadCheck/" 
response = requests.post(api_url,
                         headers={'Authorization': 'token {}'.format(token)},
                         data={"deployment":"mydeploymentid",
                    "originalnames"["myfile1.jpg","myfile2.jpg"]            
                         )
print(response.json())


#Check a device


response = requests.post(api_url,
                         headers={'DeviceToken': devicetoken},
                         data={"device":"mydevicelabel",
                    "originalnames"["myfile1.jpg","myfile2.jpg"]            
                         )
print(response.json()

#Check a device using a device token

response = requests.post(api_url,
                         headers={'Authorization': 'token {}'.format(token)},
                         data={
                    "originalnames"["myfile1.jpg","myfile2.jpg"]            
                         )
print(response.json()

Details

URL : api/Fileupload/

Method : PUT

Auth required : YES