CardDAV icon

CardDAV

Interact with CardDAV servers for address book operations

Overview

This node interacts with CardDAV servers to manage address book data. Specifically, the Delete Contact operation removes a contact from a specified address book on a CardDAV server. This is useful for automating contact management tasks such as cleaning up outdated or unwanted contacts in an address book.

Practical examples include:

  • Automatically deleting contacts that meet certain criteria (e.g., duplicates or unsubscribed users).
  • Integrating with other systems to sync and maintain a clean address book.
  • Removing contacts as part of a workflow triggered by external events.

Properties

Name Meaning
Address Book Path The server-relative path to the address book containing the contact. Must start with "/". Spaces and special characters are automatically URL-encoded. Example: /addressbooks/user/contacts/
Contact ID The unique identifier of the contact to delete. This corresponds to the contact's filename without extension. Example: contact-123

Output

The node outputs a JSON object with the following fields:

  • success: A boolean indicating whether the deletion was successful (true if HTTP status code is between 200 and 299).
  • statusCode: The HTTP status code returned by the CardDAV server for the delete request.
  • contactId: The identifier of the contact that was requested to be deleted.
  • addressBookPath: The normalized path of the address book where the contact was deleted.

No binary data output is produced by this operation.

Example output JSON:

{
  "success": true,
  "statusCode": 204,
  "contactId": "contact-123",
  "addressBookPath": "/addressbooks/user/contacts/"
}

Dependencies

  • Requires connection to a CardDAV server with valid credentials including a base URL starting with http:// or https://.
  • The node expects an API key or authentication token configured in the credentials to authorize requests.
  • The CardDAV server must support standard HTTP methods like DELETE for contact management.
  • n8n environment must have network access to the CardDAV server.

Troubleshooting

Common Issues

  • 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 includes the protocol and is correctly formatted.
  • Absolute URLs in Paths: The address book path and contact paths must be server-relative (start with /). Absolute URLs are not allowed and will cause errors.
  • Network Errors: Connection refused, host not found, or timeouts indicate network or server availability issues.
  • Permission Denied: If the API key or credentials lack permission to delete contacts, the server may return HTTP 403 or similar errors.

Error Messages and Resolutions

  • "Invalid Base URL in credentials. Include protocol (http:// or https://), e.g. https://your-server/remote.php/dav"
    Fix: Update credentials to include a valid base URL with protocol.

  • "Absolute URLs are not allowed in path fields. Use a server-relative path starting with '/'."
    Fix: Provide only relative paths starting with / for address book and contact paths.

  • "Host not found"
    Fix: Check the server hostname and network connectivity.

  • "Connection refused"
    Fix: Verify the CardDAV server is running and accessible on the specified port.

  • "Connection timed out"
    Fix: Network might be slow or unreachable; check connectivity and server status.

  • HTTP errors like 404 or 403 indicate resource not found or insufficient permissions respectively.

Links and References

Discussion