CLI Mode
The standard command-line💻CLIText-based interface for running commands.View in glossary interface is the primary way to use RAPS🌼RAPSRust CLI for Autodesk Platform Services.View in glossary. It’s designed for scripts, automation🤖AutomationReplacing manual processes with software.View in glossary, and CI/CD🔁CI/CDAutomated build, test, and deployment pipelines.View in glossary pipelines.
Quick Start
# Install RAPS
cargo install raps
# Configure credentials
export APS_CLIENT_ID="your_client_id"
export APS_CLIENT_SECRET="your_client_secret"
# Run commands
raps auth test
raps bucket list
Command Structure
RAPS follows a consistent command▶️CommandInstruction executed by a CLI tool.View in glossary structure:
raps <command> <subcommand> [arguments] [flags]
Examples
# Authentication
raps auth test
raps auth login --3lo
raps auth status
# Bucket operations
raps bucket list
raps bucket create my-bucket --retention transient
raps bucket delete my-bucket
# Object operations
raps object upload my-bucket model.rvt
raps object download my-bucket model.rvt
raps object list my-bucket
# Translation
raps translate start <URN> --format svf2
raps translate status <URN> --wait
raps translate manifest <URN>
Output Formats
RAPS supports multiple output formats for easy integration:
# JSON (machine-readable)
raps bucket list --output json
# YAML
raps bucket list --output yaml
# CSV (spreadsheet-friendly)
raps bucket list --output csv
# Table (default, human-readable)
raps bucket list --output table
# Plain text
raps bucket list --output plain
Piping to Other Tools
# Parse JSON with jq
raps bucket list --output json | jq '.[] | .bucketKey'
# Count objects
raps object list my-bucket --output json | jq 'length'
# Filter by pattern
raps object list my-bucket --output json | jq '.[] | select(.objectKey | contains(".rvt"))'
Global Flags
These flags work with all commands:
| Flag🚩FlagOptional parameter modifying command behavior.View in glossary | Description |
|---|---|
--output <format> | Output format: json📋JSONStandard data interchange format.View in glossary, yaml📝YAMLHuman-readable configuration format.View in glossary, csv📊CSVTabular data format for spreadsheets.View in glossary, table, plain |
--no-color | Disable colored output |
--quiet | Minimal output (data only) |
--verbose | Show request summaries |
--debug | Full trace with secret🔒SecretEncrypted sensitive configuration value.View in glossary redaction |
--timeout <seconds> | HTTP🔗HTTPProtocol for web communication.View in glossary request timeout (default: 120) |
--non-interactive | Fail on prompts instead of waiting |
--yes | Auto-confirm destructive operations |
Examples
# Quiet mode for scripts
BUCKET=$(raps bucket list --output json --quiet | jq -r '.[0].bucketKey')
# Debug API calls
raps auth test --debug
# Non-interactive for CI/CD
raps bucket delete my-bucket --yes --non-interactive
Exit Codes
RAPS uses standardized exit codes for scripting:
| Code | Meaning |
|---|---|
0 | Success |
2 | Invalid arguments |
3 | Authentication failure |
4 | Resource not found |
5 | Remote/API🔌APIInterface for software components to communicate.View in glossary error |
6 | Internal error |
Using in Scripts
#!/bin/bash
set -e
# Test authentication first
if ! raps auth test; then
echo "Authentication failed!"
exit 1
fi
# Upload file
raps object upload my-bucket model.rvt
# Check exit code
if [ $? -eq 0 ]; then
echo "Upload successful"
else
echo "Upload failed"
exit 1
fi
Environment Variables
Configure RAPS via environment variables:
# Required
export APS_CLIENT_ID="your_client_id"
export APS_CLIENT_SECRET="your_client_secret"
# Optional
export APS_CALLBACK_URL="http://localhost:8080/callback" # For 3-legged OAuth
export APS_DA_NICKNAME="your_nickname" # For Design Automation
export APS_REGION="US" # Default region (US or EMEA)
Using .env Files
Create a .env file in your working directory:
APS_CLIENT_ID=your_client_id
APS_CLIENT_SECRET=your_client_secret
APS_CALLBACK_URL=http://localhost:8080/callback
RAPS automatically loads .env files.
Profile Management
Manage multiple configurations for different environments:
# Create a profile
raps config profile create production
# Set values
raps config set client_id "prod_client_id"
raps config set client_secret "prod_client_secret"
# Switch profiles
raps config profile use production
# List profiles
raps config profile list
# Use specific profile for a command
raps --profile production bucket list
Scripting Patterns
Upload and Translate
#!/bin/bash
BUCKET="my-project"
FILE="model.rvt"
# Upload
raps object upload "$BUCKET" "$FILE"
# Get URN
URN=$(raps object urn "$BUCKET" "$FILE")
# Start translation and wait
raps translate start "$URN" --format svf2 --wait
# Check result
raps translate manifest "$URN" --output json
Batch Processing
#!/bin/bash
BUCKET="batch-uploads"
# Upload all RVT files
for file in models/*.rvt; do
echo "Uploading $file..."
raps object upload "$BUCKET" "$file"
done
# Or use built-in batch upload
raps object upload "$BUCKET" models/*.rvt --batch --parallel 5
Conditional Operations
#!/bin/bash
# Check if bucket exists
if raps bucket get my-bucket > /dev/null 2>&1; then
echo "Bucket exists"
else
echo "Creating bucket..."
raps bucket create my-bucket --retention persistent
fi
Shell Completions
Enable auto-completion in your shell🖥️TerminalApplication for running command-line programs.View in glossary:
Bash
# Add to ~/.bashrc
eval "$(raps completions bash)"
Zsh
# Add to ~/.zshrc
eval "$(raps completions zsh)"
Fish
raps completions fish > ~/.config/fish/completions/raps.fish
PowerShell
# Add to $PROFILE
raps completions powershell | Out-String | Invoke-Expression
Best Practices
1. Use JSON Output for Parsing
# Good: Parse structured data
raps bucket list --output json | jq '.[] | .bucketKey'
# Avoid: Parsing table output
raps bucket list | grep my-bucket # Fragile!
2. Check Exit Codes
# Good: Check for errors
if raps auth test; then
echo "Authenticated"
fi
# Good: Fail fast
set -e
raps bucket create my-bucket
3. Use —quiet for Scripting
# Good: Clean output
URN=$(raps object urn my-bucket file.rvt --quiet)
# Avoid: Parsing progress messages
URN=$(raps object urn my-bucket file.rvt 2>/dev/null)
4. Use Profiles for Environments
# Good: Named profiles
raps --profile production bucket list
raps --profile staging bucket list
# Avoid: Changing env vars frequently
export APS_CLIENT_ID="..." # Error-prone!
Related Documentation
- Configuration — Detailed configuration⚙️ConfigurationSettings controlling application behavior.View in glossary options
- Authentication — Auth commands and flows
- Exit Codes — Complete exit code🚦Exit CodeNumeric status returned when a command completes.View in glossary reference
- Pipelines — YAML-based automation