h2020-westlife-eu / virtualfolder

Virtual Folder
http://internal-wiki.west-life.eu/w/index.php?title=D6.1
MIT License
1 stars 0 forks source link

sample codes to demonstrate access to WEBDAV #58

Closed TomasKulhanek closed 6 years ago

TomasKulhanek commented 6 years ago

e.g. in BASH, C#, RUBY, PYTHON, Javascript - into VF documentation.

TomasKulhanek commented 6 years ago

BASH and CURL 1) To upload file, HTTP PUT method to WEBDAV is preferred, HTTP POST may not be implemented by WEBDAV servers.

With CURL you may try the following:

a) obtain folder URL using upload dir picker component [url] (go to https://portal.west-life.eu/virtualfolder/filepicker.html click on 'Open Upload Dir...' select dir and copy Directory URL) e.g. https://portal.west-life.eu/webdav/12323345/b2drop/myfolder b) have [filename] to be created README.txt c) have [data] to be written into the file, e.g. "Great times call for great men."

curl -X PUT [url]/[filename] --data "[data]"

e.g. curl -X PUT https://portal.west-life.eu/webdav/12323345/b2drop/myfolder/README.txt --data " Great time call for great men."

2) To get the content of the file you can HTTP GET it by:

curl https://portal.west-life.eu/webdav/12323345/b2drop/myfolder/README.txt