Trying to figure out how to receive data from external source, write it into a file and process with an external script. First time approaching something like that, I would deeply appreciate some guidance. This is how I see it at present:
-
Step One - transport to Nextcloud
- Establish API endpoint:
I have played with GET requests using curl via OCS API as user but no clue how to access a specific file to write? https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#direct-download
Do I need to create a separate app to receive data using REST by creating routes in PHP? REST APIs — Nextcloud latest Developer Manual latest documentation or should I follow the JavaScript way with axios? JavaScript APIs — Nextcloud latest Developer Manual latest documentation - POST/PUT JSON (or x-www-form-urlencoded?) data with custom header options to URL - do I need to authenticate as a user like with OSC API or can I generate a dedicated authentication token? Could I use PUT in order to append an existing file (.csv) rather than POST to create a new file?
- Establish API endpoint:
-
Step Two - process the file
- Upon modifying/creating the file, trigger an external script via Flow https://github.com/nextcloud/workflow_script - I have written the python code I run locally on .csv. Don’t know how to reference my main.py file (presumably to be placed on the same machine) - as a bash script typed into the ‘Run script’ input field, providing the absolute path?
- Output a spreadsheet file - since this is an external script I can write to the local Nextcloud path and the Files app will acknowledge it? If so, is that a bad practice?