Skip to main content

Command line utility for SoftwareOne Marketplace Platform

Project description

mpt-cli

mpt-cli is a command-line utility to manage products, price lists, and accounts in the SWO Marketplace.

Quick Start

  1. Launch the tool:

    make run
    
  2. Add a new account with your API token and endpoint:

    mpt-cli accounts add <token_id> -e <api_endpoint>
    

    Example:

    mpt-cli accounts add idt:xxxxx -e https://api.s1.show
    

Installation

Install with pip or your favorite PyPI package manager:

pip install swo-marketplace-cli
uv add swo-marketplace-cli

Prerequisites

  • Python 3.12+ in your environment
  • Access to the SWO Marketplace API endpoint

Configuration

Account Storage

The CLI stores account configurations in JSON files under ~/.swocli by default. Each account includes:

  • API token
  • API endpoint URL
  • Account metadata

Usage

Account Management

Before using the CLI, you need to configure at least one account.

Adding an Account

Add a new account with your API token and endpoint:

mpt-cli accounts add <token_id> -e <api_endpoint>

Example:

mpt-cli accounts add idt:xxxxx -e https://api.s1.show

Options:

  • -e, --endpoint <url> – API endpoint URL (required)

Listing Accounts

View all configured accounts and see which one is active:

mpt-cli accounts list

The output shows all accounts with their IDs and endpoints. The active account is marked with an asterisk (*).

Activating an Account

If you have multiple accounts, switch between them:

mpt-cli accounts activate <account_id>

The active account is used for all subsequent API operations.

Removing an Account

Delete an account from your configuration:

mpt-cli accounts remove <account_id>

Note: You cannot remove the currently active account. Activate a different account first.

Working with Products

Listing Products

Display available products:

mpt-cli products list

Options:

  • --page <number> – Specify page number (default: 1)
  • --limit <number> – Results per page (default: 25)

The output shows product ID, name, status, and version information.

Exporting Products

Export one or more products to Excel files:

mpt-cli products export <product_id> [<product_id>...] -o <output_folder>

Example:

mpt-cli products export PRD-1234-5678 PRD-9876-5432 -o ./exports

Options:

  • -o, --output-dir <folder> – Output directory for exported files

If no output folder is specified, files are saved to the current directory with the format <product-id>.xlsx.

Exported data includes:

  • General product information
  • Product settings
  • Items and item groups
  • Parameters (agreement, assets, item, request, subscription)
  • Parameter groups
  • Templates

Synchronizing Products

Synchronize products from Excel definition files:

mpt-cli products sync <file_path> [<file_path>...]

Options:

  • -r, --dry-run – Do not sync Product Definition. Check the file consistency only
  • -f, --force-create – Force create a new product even if the Product ID exists

Example:

mpt-cli products sync PRD-1234-5678.xlsx PRD-9876-5432.xlsx
mpt-cli products sync --force-create PRD-1234-5678.xlsx

Working with Price Lists

Synchronizing Price Lists

Upload and synchronize price lists from Excel files:

mpt-cli pricelists sync <file_path> [<file_path>...]

Example:

mpt-cli pricelists sync PRC-1234-5678.xlsx

Exporting Price Lists

Export price list data to Excel files:

mpt-cli pricelists export <pricelist_id> [<pricelist_id>...] -o <output_folder>

Example:

mpt-cli pricelists export PRC-1234-5678 -o ./exports

Options:

  • -o, --output-dir <folder> – Output directory for exported files

If no output folder is specified, files are saved to the current directory with the format <pricelist-id>.xlsx.

Getting Help

Run mpt-cli --help to see all available commands and options:

mpt-cli --help
mpt-cli accounts --help
mpt-cli products --help
mpt-cli products export --help
mpt-cli pricelists --help

Troubleshooting

Common Issues

Account not found:

  • Error: "Account not found" or similar
  • Cause: The specified account ID doesn't exist
  • Solution: Run mpt-cli accounts list to see available accounts

Authentication failed:

  • Error: "Authentication failed" or 401 errors
  • Cause: Invalid or expired API token
  • Solution: Verify your token is correct and has not expired. Add the account again with a valid token

API endpoint unreachable:

  • Error: Connection errors or timeouts
  • Cause: Invalid endpoint URL or network issues
  • Solution: Verify the endpoint URL is correct and accessible from your network

Product/Price list not found:

  • Error: "Product not found" or "Price list not found"
  • Cause: The specified ID doesn't exist or you don't have access
  • Solution: Verify the ID is correct and your account has appropriate permissions

Invalid Excel file format:

  • Error: "Invalid file format" or validation errors
  • Cause: The Excel file doesn't match the expected structure
  • Solution: Export a valid product/price list to see the correct format, then modify your file to match

Permission denied:

  • Error: "Permission denied" or 403 errors
  • Cause: Your account doesn't have sufficient permissions
  • Solution: Contact your administrator to verify your account has the required permissions

File not found:

  • Error: "File not found" when syncing
  • Cause: The specified file path doesn't exist
  • Solution: Verify the file path is correct and the file exists

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpt_cli-5.7.0.tar.gz (92.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mpt_cli-5.7.0-py3-none-any.whl (148.8 kB view details)

Uploaded Python 3

File details

Details for the file mpt_cli-5.7.0.tar.gz.

File metadata

  • Download URL: mpt_cli-5.7.0.tar.gz
  • Upload date:
  • Size: 92.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.22

File hashes

Hashes for mpt_cli-5.7.0.tar.gz
Algorithm Hash digest
SHA256 4e43e21f36d50934348f715c5a00eeefc400b652ad794dbd47894bffd430d97c
MD5 7fb74f6f833f8386606dee5ddab0892f
BLAKE2b-256 5d7944afaa66e89d43edd8d38e53cf8767cda3451c71302cf02c0430f2e0753a

See more details on using hashes here.

File details

Details for the file mpt_cli-5.7.0-py3-none-any.whl.

File metadata

  • Download URL: mpt_cli-5.7.0-py3-none-any.whl
  • Upload date:
  • Size: 148.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.22

File hashes

Hashes for mpt_cli-5.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a658116f67bb0c8033fadbd66dae05697d0f400ce7820ce571702aeb7e7132b3
MD5 6ffb8f6f2c2022f0b2640e7d51b3df77
BLAKE2b-256 5a937ee4cd682acf0ce6376f3a777bd99ad3c7e15dfb16311c2e8c9ee2850693

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page