Command Line Interface
ABConnect provides a comprehensive command-line interface through the ab command. This guide covers all available commands and their usage.
Installation
After installing ABConnect, the ab command becomes available in your terminal:
pip install ABConnect
Verify the installation:
ab --version
Environment Setup
The CLI requires environment configuration files. Create them from the sample:
cp .env.sample .env.staging
cp .env.sample .env
Edit both files with your credentials:
# ABC Connect credentials
ABCONNECT_USERNAME=your_username
ABCONNECT_PASSWORD=your_password
ABC_CLIENT_ID=your_app_name
ABC_CLIENT_SECRET=your_client_secret
# API environment setting
ABC_ENVIRONMENT=staging # or 'production'
Note
To request a client secret, contact abconnect@annexbrands.com
Available Commands
Version Information
ab --version
Display the current version of ABConnect.
Configuration Management
ab config
View and manage your configuration settings.
User Information
ab me
Get information about the currently authenticated user.
Company Information
ab company <company_id>
Retrieve information about a specific company.
Example:
ab company 12345
Quote Operations
ab quote <quote_type> [options]
Get shipping quotes. Supports two quote types:
qq- Quick Quoteqr- Quote Request
Examples:
# Quick quote
ab quote qq --origin "New York, NY" --destination "Los Angeles, CA"
# Quote request
ab quote qr --file quote_data.json
Lookup Values
ab lookup <type>
Look up master constant values from the API.
Available lookup types:
company-typescontact-typesjob-statusescontainer-types
Example:
ab lookup company-types
File Loading
ab load <file_path> [options]
Load and display data from CSV, JSON, or Excel files.
Options:
--format- Specify output format (json, table, csv)--encoding- Specify file encoding (default: auto-detect)
Examples:
# Load CSV file
ab load data.csv
# Load Excel file with specific sheet
ab load report.xlsx --sheet "Sales Data"
# Output as JSON
ab load contacts.csv --format json
API Endpoints
ab endpoints [options]
List all available API endpoints.
Options:
--filter- Filter endpoints by keyword--format- Output format (list, json)
Examples:
# List all endpoints
ab endpoints
# Filter by keyword
ab endpoints --filter company
# Output as JSON
ab endpoints --format json
Raw API Calls
ab api raw <method> <endpoint> [options]
Execute raw API calls for advanced usage.
Options:
--data- JSON data for POST/PUT requests--params- Query parameters--headers- Additional headers
Examples:
# GET request
ab api raw GET /companies/12345
# POST request with data
ab api raw POST /contacts --data '{"name": "John Doe", "email": "john@example.com"}'
# GET with query parameters
ab api raw GET /jobs --params '{"status": "active", "limit": 10}'
Common Workflows
Finding Company Information
List company types to understand the categories:
ab lookup company-types
Get specific company details:
ab company 12345
Working with Quotes
Prepare quote data in a JSON file
Submit quote request:
ab quote qr --file quote_request.json
Check quote status using raw API:
ab api raw GET /quotes/QUOTE_ID
Data Import Workflow
Prepare your data in CSV or Excel format
Preview the data:
ab load contacts.csv --limit 5
Process the full file:
ab load contacts.csv --format json > processed_contacts.json
Environment Variables
The CLI respects these environment variables:
ABC_ENVIRONMENT- Set tostagingorproductionABC_LOG_LEVEL- Set logging verbosity (DEBUG, INFO, WARNING, ERROR)ABC_TOKEN_FILE- Custom path for token storage
Example:
# Use production environment for a single command
ABC_ENVIRONMENT=production ab company 12345
Troubleshooting
Authentication Issues
If you encounter authentication errors:
Verify your credentials in the
.envfileCheck that
ABC_CLIENT_SECRETis set correctlyTry clearing cached tokens:
rm ~/.abconnect/token.json
Connection Problems
For connection issues:
Verify your internet connection
Check if you’re using the correct environment (staging vs production)
Enable debug logging:
ABC_LOG_LEVEL=DEBUG ab me
File Loading Errors
When file loading fails:
Verify the file path is correct
Check file permissions
Try specifying encoding explicitly:
ab load data.csv --encoding utf-8
See Also
CLI Quick Start - Quick start guide for CLI usage
CLI Examples - More CLI examples and use cases
Endpoint Reference - Full API endpoint documentation