WebDAV icon

WebDAV

Interact with WebDAV servers for file operations

Overview

This node interacts with WebDAV servers to perform various file operations such as retrieving file properties, downloading files, uploading files, creating directories, deleting files or folders, and moving or copying resources. It is useful in scenarios where you need to automate file management on a WebDAV-compatible server, for example, syncing files between systems, backing up data, or managing remote file storage.

The "Get Properties" operation specifically sends a PROPFIND request to retrieve metadata about a file or directory at a specified path. This includes details like content type, last modification date, size, and whether the resource is a collection (folder). The depth of the query can be controlled to get properties of just the resource, its immediate children, or all descendants.

Practical examples:

  • Fetching metadata of a single file to check its size and last modified date.
  • Listing properties of all files and folders inside a directory.
  • Recursively retrieving properties of all nested files and folders under a root directory.

Properties

Name Meaning
Path Path to the resource to get properties for. Use "/" for root. Spaces and special characters are auto-encoded. Must be a server-relative path starting with "/".
Depth Depth of the PROPFIND request determining how many levels of descendants to include:
- 0 (Resource Only)
- 1 (Resource + Children)
- Infinity (All Descendants)

Output

The output JSON contains the following structure:

  • properties: An array of objects, each representing a resource found by the PROPFIND request. Each object includes:

    • href: The decoded path of the resource.
    • contentType: MIME type of the resource if available.
    • lastModified: Last modification timestamp as a string.
    • contentLength: Size of the resource in bytes (number).
    • isCollection: Boolean indicating if the resource is a folder/collection.
  • statusCode: HTTP status code returned by the PROPFIND request.

Example output JSON snippet:

{
  "properties": [
    {
      "href": "/documents/report.pdf",
      "contentType": "application/pdf",
      "lastModified": "Wed, 21 Jun 2023 10:00:00 GMT",
      "contentLength": 123456,
      "isCollection": false
    },
    {
      "href": "/documents/photos/",
      "contentType": null,
      "lastModified": "Tue, 20 Jun 2023 15:30:00 GMT",
      "contentLength": null,
      "isCollection": true
    }
  ],
  "statusCode": 207
}

Dependencies

  • Requires an API key credential configured with the WebDAV server base URL.
  • The base URL must include the protocol (http:// or https://) and be valid.
  • The node uses HTTP methods including PROPFIND with XML bodies to communicate with the WebDAV server.
  • No additional external libraries beyond standard HTTP request helpers provided by n8n.

Troubleshooting

  • Invalid Base URL: If the base URL in credentials is missing or does not start with http:// or https://, the node will throw an error. Ensure the URL is correct and includes the protocol.
  • Absolute URLs in Path: Paths must be server-relative starting with /. Absolute URLs in path parameters cause errors.
  • Connection Errors: Common network errors like host not found, connection refused, or timeout indicate issues with server accessibility or incorrect hostname/port.
  • HTTP Errors: Non-success HTTP status codes from the WebDAV server will be reported with their status and message. Check server permissions and path correctness.
  • Malformed XML Response: If the server returns unexpected XML or no data, the node may fail to parse properties.
  • Depth Parameter: Using very high depth (like infinity) on large directories may cause performance issues or timeouts.

Links and References

Discussion