Up and Download Files to a Device¶
There are two additional endpoints /files/upload/
and files/download/
which allow to upload and download files.
Uploading can be used to send a set of instructions which can then be executed autonomously, for example.
Downloading files is mostly to save the data which was recorded previously.
Both methods can be found in /api/files/routes.py
while the default file names can be configured with the right configuration parameters.
Note
Feel free to adjust the up and download methods by your needs but note that the application always always only calls files/download/
without any speciefied filename.
Upload¶
You can upload file to your device by specifying the file-upload type as an option in your device.json.
If you use the provided implementation, adjust the upload path if needed in config.py
. The device will then always override the this file when a new one is uploaded.
However, you can adjust this method as you wish but be careful. Most likely you would then also need to pass the filename for the file to use when executing the instructions stored there. This could be done with an input type for example.
Download¶
Currently the download only gets triggered when you press the Download Recording
button on the send page of the device (recording must be enabled to see it).
The same rules apply as in upload. The default filename can be adjusted in config.py
. Also it is possible to adjust this method, but the application calls files/download/
only. So you must make sure to return the correct file there.