Accessing Egnyte WebDAV Programatically

Updated 9/5/2013

Overview

The WebDAV protocol is based on, and extends, the HTTP protocol; Egnyte currently provides WebDAV based programmatic and command line access to the /Shared and /Private folders on the Cloud File Server (CFS).  This article describes how you can connect to Egnyte programatically via WebDAV.

In another article, we describe how to connect with Egnyte via our public RESTful APIs. You can also access our developer's page for more detailed information about these REST APIs.

WebDAV access is limited to Admins and Power Users.

How-To

Our WebDAV service supports basic file operations such as uploading files, creating folders and modifying the folder structure through its protocol methods.

Cloud File Server Operation

WebDAV Protocol Method

Download file

GET

Upload file

PUT

Folder listing

PROPFIND

Create Folder

MKCOL

Copy file or folder

COPY

Move or renaming a  file or folder

MOVE

Lock file

LOCK

Unlock file

UNLOCK

cURL, a popular project, provides both a client library and a command line tool that can be used to access Egnyte over WebDAV. Other client libraries are also available for most programming languages and platforms.

cURL command line to access Egnyte services

In the following illustrative commands, we are using acme.egnyte.com as your Egnyte Cloud File Server domain.

List Folder Content

curl --request PROPFIND -v --user <egnyte-username>@acme:<egnyte-password> https://acme.egnyte.com/webdav/Shared/Marketing 

Download File 

curl --request GET -v --user <egnyte-username>@acme:<egnyte-password> https://acme.egnyte.com/webdav/Shared/Finance/Q1_Report.xls > Q1.xls

Here the Q_Report.xls file from your /Shared/Finance folder will be downloaded and saved to Q1.xls in the current folder.

Upload File

To upload a local file Q2.xls form the current local folder to /Shared/Finance -

curl --request PUT --data-binary "@Q2.xls"  -v --user  <egnyte-username>@acme:<egnyte-password> https://acme.egnyte.com/webdav/Shared/Finance/Q2.xls

Create Folder

To create a folder /Shared/Marketing

curl request MKCOL -v --user <egnyte-username>@acme:<egnyte-password> https://acme.egnyte.com/webdav/Shared/Marketing 

Lock File  

To lock a file /Shared/Marketing/fin_res.ppt

curl request LOCK -v --user <egnyte-username>@acme:<egnyte-password> https://acme.egnyte.com/webdav/Shared/Marketing/fin_res.ppt

Unlock File

To unlock file /Shared/Marketing/fin_res.ppt

curl --request UNLOCK -v –user <egnyte-username>@acme:<egnyte-password> https://acme.egnyte.com/webdav/Shared/Marketing/fin_res.ppt

Rename/Move File or Folder

To rename/move /Shared/Marketing/2009 to /Shared/Marketing/2010

curl --request MOVE --user <egnyte-username>@acme:<egnyte-password> -H Destination:" - https://acme.egnyte.com/webdav/Shared/Marketing/2010" --insecure --silent --show-error --stderr - https://acme.egnyte.com/webdav/Shared/Marketing/2009

Copy File or Folder

To copy /Shared/Marketing/2009 to /Shared/Marketing/2010

curl --request COPY --user <egnyte-username>@acme:<egnyte-password> -H Destination:" - https://acme.egnyte.com/webdav/Shared/Marketing/2010" --insecure --silent --show-error --stderr - https://acme.egnyte.com/webdav/Shared/Marketing/2009

Was this article helpful?
8 out of 8 found this helpful
Have more questions? Submit a request

Comments

Article is closed for comments.