SanMar API Toolkit for Openclaw

A deterministic, JSON-in/JSON-out CLI wrapper that connects AI coding agents to SanMar's SOAP web services and PromoStandards order systems.

zmtucker
v0.1.0
Jun 17, 2026
0
405
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install sanmar

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install sanmar using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is SanMar API Toolkit?

The SanMar API Toolkit is a self-contained, highly deterministic integration skill designed to bridge AI systems with SanMar's enterprise SOAP web services and PromoStandards. Utilizing a standard CLI interface, it enables agents to execute queries and manage transactions without requiring heavy dependencies like an ORM or complex SOAP libraries. By using this tool, developers can empower their workflows with robust, programmatic apparel sourcing, real-time inventory checks, and secure purchase order submissions.

Adding this package to your suite of Openclaw Skills ensures reliable automation for e-commerce, procurement, and supply chain management. It handles everything from pricing checks to mainframe color resolution, ensuring high-fidelity communication with SanMar's backend systems.

SanMar API Toolkit Use Cases

  • Querying SanMar's catalog for specific product styles, colorways, sizes, and product images.
  • Fetching real-time, warehouse-specific inventory counts for accurate stock checks.
  • Retrieving custom, customer-specific pricing (myPrice) for automated margin calculations.
  • Validating draft purchase orders and shopping carts prior to finalizing transactions.
  • Automatically parsing PDF invoice documents or purchase orders into structured JSON drafts.
  • Resolving non-standard marketing color names into mainframe-compatible color codes using SFTP data feeds.

How SanMar API Toolkit Works

  1. CLI Execution: The host system invokes the toolkit by piping a JSON payload into the sanmar.py executable alongside a designated action name.
  2. Credential Loading: The toolkit extracts authentication details from standard environment variables (or directly from inline JSON keys) to construct the SOAP headers.
  3. SOAP and SFTP Handshaking: The script securely connects to SanMar's production or development endpoints, handling the raw XML translation and response parsing natively.
  4. Color Correction Fallback: If a marketing color name fails to map, the tool can programmatically download and query SanMar's SDL CSV database over SFTP to resolve it.
  5. Standardized Output: A cleanly formatted JSON response is emitted on stdout, while errors are captured and returned in a predictable, non-zero-exit schema.

SanMar API Toolkit Setup

To integrate this into your ecosystem of Openclaw Skills, set up your Python environment and configure the required environment variables.

Prerequisites and Installation

Ensure you have Python 3.11+ installed. Optional dependencies are loaded lazily depending on your use cases:

# Install core dependencies
uv pip install "requests>=2.28"

# Optional: Required for parse-po-pdf (PDF intake)
uv pip install "pypdf>=4.0"

# Optional: Required for SFTP mainframe-color resolution
uv pip install "paramiko>=3.0"

Configuration

Define the following environment variables to authenticate with SanMar's SOAP and SFTP web services:

export SANMAR_CUSTOMER_NUMBER="your_customer_number"
export SANMAR_USERNAME="your_web_services_username"
export SANMAR_PASSWORD="your_web_services_password"
export SANMAR_ENV="production" # Set to "development" for test-ws PO testing

# Optional: For SFTP Mainframe Color Resolution
export SANMAR_FTP_USERNAME="your_customer_number"
export SANMAR_FTP_PASSWORD="your_sftp_password"

SanMar API Toolkit Data Schema & Taxonomy

The toolkit structures its interactions through a single CLI utility using structured inputs and outputs. Data is organized logically across the following schemas:

Primary CLI Actions and Key Inputs

Action Input Schema Keys Risk Profile Description
search-products style, color?, size? Read-only Finds style matching criteria
check-inventory style, color, size, auto_resolve_color? Read-only Gets real-time warehouse stock
get-pricing lines: [{style, color, size}] Read-only Returns customer contract myPrice pricing
validate-cart purchase_order: {...} Read-only Performs a pre-submit PO verification
create-purchase-order purchase_order: {...}, confirm: true/false High (Write) Submits PO; dry-runs when confirm is false
parse-po-pdf pdf_path Read-only Translates a raw PDF PO into structured JSON
lookup-mainframe-color style, color, force_refresh? Read-only (SFTP) Direct query of SFTP color database

Local Caching

To optimize connection overhead, the color resolution system creates a local cache directory:

  • Default Cache Path: /tmp/sme-sanmar-cache (configurable via SANMAR_FTP_CACHE_DIR)
  • Life Cycle: The SDL CSV catalog is cached locally and refreshed automatically after 24 hours to match SanMar's nightly database update schedule.

SanMar API Toolkit Advanced Features

  • Dry-Run Validation Safety: The create-purchase-order action operates with a strict safety mechanism; it requires an explicit "confirm": true flag. If missing, it outputs a complete, risk-free preview of the generated SOAP envelope.
  • Heuristic PDF Processing: Integrated parsing support extracts full product identifiers, quantities, and pricing directly from uploaded customer POs, drafting a structured configuration object ready for API submission.
  • Intelligent Mainframe Color Mapping: Automatic failover query maps common consumer marketing colors to internal SanMar mainframe codes using a background SFTP CSV connection.
  • Multi-Environment Routing: Seamlessly switch from active production endpoints to SanMar's sandbox server (test-ws.sanmar.com) using simple environment configurations for robust pipeline testing.
  • Fail-Safe Client Allowlisting: Predictable error classifications identify connection timeouts, highlighting IP-allowlist restrictions distinct from authentication errors.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*