Upload file to Synology Filestation over API

Has anyone managed to upload a file to the filestation via synology api using nodered?
I manage to download files via the api from the synology.
I can't figure it out from Synology's FileStation API documentation.
Here is the content of the function node that is connected before the http node and prepares the url to the synology, as well as the header and the payload.

msg.databuffer=msg.payload;
//Upload File Synology;
msg.DPath="/Ninox";
msg.url=msg.userProperties.SynologyAdress+"/webapi/entry.cgi?api=SYNO.FileStation.Upload&method=upload&version=2&overwrite=true&path="+msg.DPath+"&create_parents=false&_sid="+msg.SynologyID;
msg.headers = {"contenth_length":msg.headers["content-length"],"content-type" : 'multipart/form-data'}
msg.payload ={name:msg.databuffer,
filename:msg.userProperties.FileName+"."+msg.userProperties.FileEndung
}
return msg;
1 Like

Never used the API. But SSH/SCP should work. Alternatively create a suitable file share and allocate that to the device running Node-RED.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.