Magic Suite CLI
MagicSuite CLI - Command-Line Interface
The MagicSuite CLI is a powerful command-line tool for managing Magic Suite operations, providing full CRUD capabilities, tenant management, file system operations, and beautiful console output.
🚀 Installation, upgrade and removal
Prerequisites
Before installing MagicSuite CLI, you must have the .NET 10.0 SDK or later installed on your system.
- Visit https://dotnet.microsoft.com/download
- Download the .NET 10.0 SDK installer for your operating system (Windows, macOS, or Linux)
- Run the installer and follow the installation wizard
- Verify installation by opening a terminal/command prompt and running:
dotnet --versionYou should see version 10.0 or later displayed.
Installation/Upgrade/Removal Options
Option 1: .NET Global Tool (Recommended)
Once .NET is installed, install/upgrade/remove MagicSuite CLI as a global tool:
Option 2: Windows Package Manager (Winget)
Windows users may chose to install/upgrade/remove via Winget:
After installation, verify the tool is working:
magicsuite --help
✨ Key Features
- Full CRUD Operations - Create, read, update, and delete entities via API
- File System Management - Upload, download, search, and organize files
- Tenant Management - Switch between tenants with intelligent resolution
- Multiple Profiles - Manage different environments (alpha, staging, production)
- Flexible Authentication - API tokens with environment variable support
- Beautiful Output - Color-coded tables and JSON formats via Spectre.Console
- Safety Features - Confirmation prompts for destructive operations
- Built-in Help - Comprehensive --help documentation for all commands
🎯 Quick Start
First-Time Setup
Run the interactive configuration wizard to get started:
The wizard will guide you through:
- Creating your first profile
- Setting up the API URL
- Configuring authentication credentials
Manual Setup
Alternatively, configure manually:
magicsuite config profiles add alpha2
# Configure API URL
magicsuite config set api-url https://api.alpha2.magicsuite.com
# Set up authentication
magicsuite auth token --name your-token-name --key your-api-token-key
# Test connection
magicsuite auth status
📚 Command Reference
--help flag for detailed usage information:
magicsuite api get --help
magicsuite file upload --help
Configuration Commands
Profile Management:
magicsuite config profiles list
# Add new profile
magicsuite config profiles add production
# Set active profile
magicsuite config profiles set-active production
# Remove profile
magicsuite config profiles remove old-profile
Settings Management:
magicsuite config list
# Get specific setting
magicsuite config get api-url
# Set configuration value
magicsuite config set default-format json
magicsuite config set api-url https://api.magicsuite.com
Authentication Commands
magicsuite auth token --name token-name --key token-key
# Check authentication status (includes connection test)
magicsuite auth status
# Clear stored credentials
magicsuite auth logout
API Commands - Read Operations
List Entities:
magicsuite api get tenants
# Get with filtering
magicsuite api get tenants --filter "Acme"
magicsuite api get connections --filter "LogicMonitor"
# Limit results
magicsuite api get tenants --top 5
# Expand navigation properties
magicsuite api get connections --expand tenant
# JSON output
magicsuite api get tenants --format json
# Combined options
magicsuite api get connections --filter "Logic" --top 10 --format json
Supported Entity Types:
| Entity Type | Description |
|---|---|
tenants |
Tenant/customer information |
connections |
System connections (LogicMonitor, Meraki, etc.) |
reportschedules |
Scheduled report configurations |
people |
User accounts |
Get Single Entity:
magicsuite api get-by-id tenant 123
magicsuite api get-by-id connection 456
# With expansion
magicsuite api get-by-id connection 456 --expand tenant
# JSON format
magicsuite api get-by-id tenant 123 --format json
API Commands - Create Operations
magicsuite api create connection --json '{"Name":"Production LM","ConnectionType":"LogicMonitor","Url":"https://company.logicmonitor.com"}'
# Create from JSON file
magicsuite api create connection --json-file new-connection.json
# Create report schedule
magicsuite api create reportschedule --json '{"Name":"Daily Report","CronSchedule":"0 0 * * *","IsEnabled":true}'
Example JSON file (new-connection.json):
"Name": "Production LogicMonitor",
"ConnectionType": "LogicMonitor",
"Url": "https://company.logicmonitor.com/santaba",
"UserName": "api@company.com",
"Password": "your-access-key",
"Description": "Main monitoring system"
}
API Commands - Update Operations
magicsuite api patch connection 456 --json '{"Name":"Updated Name"}'
# Update multiple fields
magicsuite api patch connection 456 --json '{"Description":"New description","Url":"https://new-url.com"}'
# Update from file
magicsuite api patch connection 456 --json-file updates.json
# Update with JSON output
magicsuite api patch connection 456 --json '{"IsEnabled":false}' --format json
API Commands - Delete Operations
magicsuite api delete connection 456
# Delete without confirmation (for automation)
magicsuite api delete connection 456 --confirm
# Example: Delete report schedule
magicsuite api delete reportschedule 789
- Tenants and people cannot be deleted via CLI (use Admin UI instead)
- Confirmation is required unless the
--confirmflag is used - The entity name is displayed before deletion for verification
Tenant Commands
magicsuite tenant select ACME01
# Switch by ID
magicsuite tenant select 123
# Switch by GUID
magicsuite tenant select 550e8400-e29b-41d4-a716-446655440000
# Show current tenant
magicsuite tenant current
# Current tenant as JSON
magicsuite tenant current --format json
- Only Super Admin or Uber Admin can switch tenants
- Tenant selection is cached for session performance
File System Commands
Manage files and folders in the Magic Suite file system with full CRUD operations.
List Files and Folders:
magicsuite file list
# List specific folder
magicsuite file list /Library
# List with JSON output
magicsuite file list /Reports --format json
Upload Files:
magicsuite file upload report.pdf /Reports/monthly.pdf
# Force overwrite existing file
magicsuite file upload data.csv /Library/data.csv --force
# Upload to subfolder
magicsuite file upload image.png /Library/images/logo.png
Download Files:
magicsuite file download /Reports/monthly.pdf ./local-report.pdf
# Download to current directory
magicsuite file download /Library/data.csv ./data.csv
# Download to specific directory
magicsuite file download /Reports/analysis.xlsx ./downloads/analysis.xlsx
Create Folders:
magicsuite file create-folder /Reports/2024
# Create nested folder
magicsuite file create-folder /Library/Projects/NewProject
Rename/Move Files:
magicsuite file rename /old-name.pdf /new-name.pdf
# Move a file to different folder
magicsuite file rename /Temp/file.pdf /Archive/file.pdf
# Rename a folder
magicsuite file rename /OldFolder /NewFolder
Copy Files:
magicsuite file copy /source.pdf /backup.pdf
# Copy to different folder
magicsuite file copy /Reports/monthly.pdf /Archive/Reports/monthly-backup.pdf
# Copy a folder (recursive)
magicsuite file copy /Reports /Archive/Reports-Backup
Delete Files and Folders:
magicsuite file delete /Temp/old-file.pdf
# Delete without confirmation (for scripts)
magicsuite file delete /OldFolder --confirm
# Delete specific file
magicsuite file delete /Reports/outdated-report.pdf
Search for Files:
magicsuite file search 'budget'
# Search in specific path
magicsuite file search 'report' --path /Reports
# Search with JSON output
magicsuite file search '*.pdf' --format json
# Search for files by pattern
magicsuite file search 'Q1-2024'
File Operations Features:
- Human-readable file sizes (B, KB, MB, GB, TB)
- Type indicators (📁 folders, 📄 files)
- Formatted timestamps
- Safety confirmations for destructive operations
- Recursive folder operations
- Path validation
🌐 Global Options
All commands support these global options for flexibility:
--format <json|table> # Output format (default: table)
Examples:
magicsuite api get tenants --profile production
# Force JSON output
magicsuite config list --format json
# Combine options
magicsuite api get connections --profile alpha2 --format json
📊 Output Formats
Table Format (Default)
Beautiful, color-coded tables using Spectre.Console with:
- Property/value pairs for single entities
- Columnar tables for lists
- Color highlighting for important fields
- Emoji indicators (✓, ✗)
JSON Format
Pretty-printed JSON with camelCase naming for easy parsing and automation:
⚙️ Configuration File
Configuration is stored at:
- Windows:
%APPDATA%\MagicSuite\cli-config.json - Linux/Mac:
~/.config/MagicSuite/cli-config.json
Example configuration:
"activeProfile": "alpha2",
"profiles": {
"alpha2": {
"apiUrl": "https://api.alpha2.magicsuite.com",
"tokenName": "dev-token",
"tokenKey": "your-key-here"
},
"production": {
"apiUrl": "https://api.magicsuite.com",
"tokenName": "prod-token",
"tokenKey": "your-prod-key"
}
},
"defaultOutputFormat": "table"
}
🔐 Environment Variables
For CI/CD pipelines and automation, use environment variables instead of storing credentials:
export MAGICSUITE_TOKEN_NAME="automation-token"
export MAGICSUITE_TOKEN_KEY="your-token-key"
export MAGICSUITE_API_URL="https://api.magicsuite.com"
# Then use CLI without explicit credentials
magicsuite api get tenants
🎓 Common Workflows
Setup New Environment
magicsuite config set api-url https://api.staging.magicsuite.com
magicsuite auth token --name staging-token --key abc123
magicsuite auth status
Query and Filter Data
magicsuite api get-by-id connection 456 --expand tenant
magicsuite api get tenants --format json > tenants.json
Create and Configure Resources
magicsuite api patch connection 456 --json '{"IsEnabled":true}'
Tenant Operations
magicsuite api get connections
magicsuite tenant current
File Management
magicsuite file upload report.pdf /Reports/monthly.pdf
magicsuite file download /Reports/monthly.pdf ./report.pdf
magicsuite file search 'budget' --path /Reports
magicsuite file delete /Temp/old-files --confirm
❓ Getting Help
The CLI includes comprehensive built-in help. Use the --help flag at any level:
magicsuite --help
# Command group help
magicsuite config --help
magicsuite api --help
magicsuite file --help
# Specific command help
magicsuite api get --help
magicsuite auth token --help
magicsuite file upload --help
Each help screen provides:
- Command description and purpose
- Required and optional arguments
- Available options and flags
- Usage examples
🔍 Error Handling
The CLI provides clear, actionable error messages:
Error: Missing API credentials.
Run 'magicsuite config init' or 'magicsuite auth token' to configure credentials.
# Entity not found
Error: Connection with ID 999 not found.
# Permission denied
Error: Tenant switching requires Super Admin or Uber Admin privileges.
Current user: john@example.com (john)
🛡️ Safety Features
- Cannot delete tenants or people via CLI (must use Admin UI)
- Delete operations require confirmation unless
--confirmflag is used - Tenant switching requires Super Admin privileges
- All operations validate credentials before execution
- Entity names displayed before deletion for verification
📦 About
MagicSuite CLI is part of the Magic Suite platform developed by Panoramic Data Limited.
Built with:
- .NET 9
- System.CommandLine for command parsing
- Spectre.Console for beautiful output
- MagicSuite.Api for backend integration
Version: Automatically managed by Nerdbank.GitVersioning
📚 Additional Resources
- NuGet Package: MagicSuite.Cli