Hi Node-REDers,
UweG already had the same question a few months ago. I decided to give this issue another push.
We are looking for help with a function node to call a http-request-node properly in order to upload a file to the Synology filesystem. We've figured out all the remaining API-Calls and the fundamental understanding of the post method is the problem, i guess.
msg.method = "POST";
msg.url = "?";
msg.headers = {?};
msg.payload = {?};
return msg;
The documentation on the SynologyAPI is a little bit weird when it comes to this topic. But maybe one of you guys could find sence in it. The following starts on page 69.
Synology_File_Station_API_Guide.pdf (629.9 KB)
SYNO.FileStation.Upload
Description Upload a file. Overview
Availability: Since DSM 6.0
Version: 2
Method upload
Description:
Upload a file by RFC 1867, RFC 1867 - Form-based File Upload in HTML. Note that each parameter is passed within each part but binary file data must be the last part.
Availability: Since version 2.Request:
Parameter:path | A destination folder path starting with a shared folder to which files can be uploaded. | String
create_parents | Create parent folder(s) if none exist. | Boolean
filename | (filepart) File content. Must be the last part. | Binary dataExample:
POST /webapi/entry.cgi
…
Content-Length:20326728
Content-type: multipart/form-data, boundary=AaB03x
--AaB03x
content-disposition: form-data; name="api"
SYNO.FileStation.Upload
--AaB03x
content-disposition: form-data; name="version"
2
--AaB03x
content-disposition: form-data; name="method"
upload
--AaB03x
content-disposition: form-data; name="path"
/upload/test
--AaB03x
content-disposition: form-data; name="create_parents"
true
--AaB03x
content-disposition: form-data; name="file"; filename="file1.txt"
Content-Type: application/octet-stream
... contents of file1.txt ...
--AaB03x--Response:
No specific response. It returns an empty success response if completed without error.
Really hope someone could do a little bit of JavaScript wizardry and help us out