190 lines
5.1 KiB
Markdown
190 lines
5.1 KiB
Markdown
# kDrive n8n Node - Quick Start Guide
|
|
|
|
## 🎯 What This Node Does
|
|
|
|
This n8n node allows you to interact with Infomaniak's kDrive cloud storage service. You can perform common file management operations directly from your n8n workflows.
|
|
|
|
## 📦 What's Included
|
|
|
|
### Core Files Created:
|
|
|
|
```
|
|
n8n-nodes-kdrive/
|
|
├── package.json # Node configuration
|
|
├── src/
|
|
│ ├── index.ts # Main export
|
|
│ └── nodes/KDrive/
|
|
│ ├── KDrive.node.ts # Main node (14,496 lines)
|
|
│ ├── GenericFunctions.ts # API helpers (2,254 lines)
|
|
│ ├── KDriveCredentials.api.ts # Auth setup
|
|
│ └── kdrive.svg # Custom icon
|
|
├── README.md # User documentation
|
|
├── IMPLEMENTATION_SUMMARY.md # Technical details
|
|
└── QUICK_START.md # This file
|
|
```
|
|
|
|
## 🚀 Getting Started
|
|
|
|
### 1. Install Dependencies
|
|
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
### 2. Build the Node
|
|
|
|
```bash
|
|
npm run build
|
|
```
|
|
|
|
This will create the compiled JavaScript files in the `dist/` directory.
|
|
|
|
### 3. Install in n8n
|
|
|
|
Copy the built files to your n8n custom nodes directory and restart n8n.
|
|
|
|
## 🔑 Set Up Credentials
|
|
|
|
1. **Get your kDrive API key** from the Infomaniak developer portal
|
|
2. **Add credentials** in n8n:
|
|
- Go to Credentials
|
|
- Add new credential: "kDrive API"
|
|
- Enter your API key
|
|
- Save
|
|
|
|
## 🎨 Node Configuration
|
|
|
|
### Resource Types
|
|
|
|
Choose what you want to work with:
|
|
- **Drive**: Manage kDrive instances
|
|
- **File**: Work with files (upload, download, etc.)
|
|
- **Directory**: Create directories and files
|
|
|
|
### Available Operations
|
|
|
|
#### 🗃️ Drive Operations
|
|
- **List Drives**: See all your accessible kDrive instances
|
|
- **Get Drive Info**: Get details about a specific drive
|
|
|
|
#### 📄 File Operations
|
|
- **List Files**: Browse files in a directory
|
|
- **Get File Info**: Get file metadata
|
|
- **Upload File**: Upload files to kDrive
|
|
- **Download File**: Download files from kDrive
|
|
- **Delete File**: Move files to trash
|
|
- **Search Files**: Find files by name/content
|
|
- **Get File Versions**: See file version history
|
|
|
|
#### 📁 Directory Operations
|
|
- **Create Directory**: Make new folders
|
|
- **Create File**: Create new files with content
|
|
|
|
## 🔧 Common Parameters
|
|
|
|
### For File Operations
|
|
- **Drive ID**: Your kDrive instance ID
|
|
- **File ID**: The specific file you're working with
|
|
- **Parent Directory ID**: Where to perform the operation (use "root" for root directory)
|
|
|
|
### For Uploads
|
|
- **File Data**: Base64 encoded file content
|
|
- **File Name**: Name for the uploaded file
|
|
- **Parent Directory ID**: Where to upload (default: "root")
|
|
|
|
## 📊 Example Workflows
|
|
|
|
### Simple File Upload
|
|
|
|
```
|
|
1. HTTP Request → Get file data
|
|
2. kDrive → Upload File
|
|
- Drive ID: your_drive_id
|
|
- File Data: {{ $json.file_content_base64 }}
|
|
- File Name: document.pdf
|
|
- Parent Directory ID: root
|
|
3. Set → Store upload response
|
|
```
|
|
|
|
### Backup Important Files
|
|
|
|
```
|
|
1. Schedule → Daily at 2 AM
|
|
2. kDrive → Search Files
|
|
- Drive ID: your_drive_id
|
|
- Search Query: "important"
|
|
3. kDrive → Get File Info (for each file)
|
|
4. Database → Store file metadata
|
|
5. Email → Send backup report
|
|
```
|
|
|
|
### Organize Uploaded Files
|
|
|
|
```
|
|
1. Webhook → Receive file upload
|
|
2. kDrive → Create Directory
|
|
- Drive ID: your_drive_id
|
|
- Directory Name: {{ $json.customer_name }}
|
|
- Parent Directory ID: root
|
|
3. kDrive → Upload File
|
|
- Drive ID: your_drive_id
|
|
- File Data: {{ $json.file_content }}
|
|
- Parent Directory ID: {{ $json.new_directory_id }}
|
|
```
|
|
|
|
## 🔍 API Endpoints Used
|
|
|
|
The node uses both v2 and v3 of the kDrive API:
|
|
|
|
- **v2 Endpoints** (stable):
|
|
- `/2/drive` - List drives
|
|
- `/2/drive/{drive_id}/files/{file_id}/download` - Download
|
|
- `/2/drive/{drive_id}/files/{file_id}` - Delete
|
|
|
|
- **v3 Endpoints** (feature-rich):
|
|
- `/3/drive/{drive_id}/files/{file_id}/files` - List files
|
|
- `/3/drive/{drive_id}/files/{file_id}` - Get file info
|
|
- `/3/drive/{drive_id}/upload` - Upload files
|
|
- `/3/drive/{drive_id}/files/search` - Search files
|
|
|
|
## 🛠️ Error Handling
|
|
|
|
The node includes comprehensive error handling:
|
|
- Network errors
|
|
- API errors (4xx, 5xx responses)
|
|
- Authentication failures
|
|
- Input validation
|
|
- Continue-on-fail support
|
|
|
|
## 📈 Performance Tips
|
|
|
|
1. **Batch Processing**: For many files, use loops in n8n
|
|
2. **Pagination**: Large directories may need pagination
|
|
3. **File Size**: Large files may take time to upload/download
|
|
4. **Rate Limits**: Be aware of API rate limits
|
|
|
|
## 🔮 Future Enhancements
|
|
|
|
Consider adding:
|
|
- File moving/copying between directories
|
|
- File sharing and permissions
|
|
- Trash management (restore, permanent delete)
|
|
- Webhook support for real-time events
|
|
- Advanced search filters
|
|
|
|
## 📚 Documentation
|
|
|
|
- **User Guide**: See `README.md`
|
|
- **Technical Details**: See `IMPLEMENTATION_SUMMARY.md`
|
|
- **kDrive API Docs**: https://developer.infomaniak.com
|
|
|
|
## 🤝 Support
|
|
|
|
For issues or questions:
|
|
- Check the kDrive API documentation
|
|
- Review the error messages in n8n
|
|
- Ensure your API key is valid and has proper permissions
|
|
|
|
## 🎉 You're Ready!
|
|
|
|
Start building your kDrive workflows in n8n. The node provides a solid foundation for cloud file management automation. |