Deterministic SanMar API toolkit covering the four order-lifecycle pillars — purchase orders, inventory, tracking, and invoicing — behind typed CLI tools over SanMar's SOAP web services, PromoStandards services, and SFTP data feeds. Submit and pre-validate POs; check real-time per-warehouse inventory (PromoStandards v2) or bulk FTP feeds; get package-level tracking (Order Shipment Notification) and parse the FTP Daily Shipment Status file; retrieve invoices (InvoicePort — by PO, invoice number, order date, date range, or unpaid) and parse the FTP Daily Invoice / EDI-810 files, all normalized to a common payables shape. Also search products, pull myPrice pricing, parse PO PDFs, resolve marketing colors to mainframe codes, and file portal returns. Use whenever the user needs to read from or write to SanMar for apparel sourcing, pricing, ordering, tracking, or accounts-payable.
文档
Sanmar
试用Deterministic SanMar API toolkit — wraps SanMar's SOAP web services and PromoStandards order-shipment service behind typed CLI tools. Search products, check...
它能做什么
Deterministic SanMar API toolkit — wraps SanMar's SOAP web services and PromoStandards order-shipment service behind typed CLI tools. Search products, check real-time warehouse inventory, pull customer-specific (myPrice) pricing, validate carts, submit and track purchase orders, parse PO PDFs, and resolve marketing color names to SanMar mainframe color codes. Use whenever the user needs to read from or write to SanMar for apparel sourcing, pricing, ordering, or order tracking.
技能文档
SanMar API toolkit
This skill is a deterministic, JSON-in / JSON-out wrapper over SanMar's SOAP web services and the PromoStandards order-shipment-notification service. Every tool is reached through one CLI entrypoint:
echo '' | python3 scripts/sanmar.py
The action is the first CLI argument; arguments are a JSON object on
stdin. Each call prints a single JSON object on stdout, or
{"error": {"type": ..., "message": ...}} with a non-zero exit code on failure.
The skill is self-contained: no Odoo, no ORM, no lxml. It needs Python 3.11+
and requests; all XML/SOAP work uses the stdlib xml.etree.ElementTree. Two
optional installs unlock two tools:
pypdf>=4.0— required forparse-po-pdf(PDF text extraction).paramiko>=3.0— required forlookup-mainframe-colorand the marketing-color auto-resolve fallback incheck-inventory/get-pricing.
Both are imported lazily, so the skill still loads without them; the affected
tools raise a clear error pointing at the missing pip install.
When to use this skill
Reach for a scripts/sanmar.py action when the request involves any of:
- Looking up SanMar product styles, colors, sizes, or images.
- Checking real-time inventory at SanMar warehouses for a style/color/size.
- Pulling customer-specific (
myPrice) pricing for a SKU. - Validating a draft cart of style/color/size lines before ordering.
- Submitting a SanMar purchase order, or polling its status / tracking.
- Parsing an uploaded PDF purchase order into a structured draft for review.
- Translating a marketing color name (e.g. "Athletic Heather") into SanMar's mainframe color code (e.g. "ATHHTHR") when inventory/pricing rejects the consumer-facing color.
Do not use it for other apparel vendors (S&S, Alpha, etc.), and never invent SanMar request shapes from prose — call the deterministic actions.
Actions
| Action | Risk | stdin JSON (key fields) |
|---|---|---|
search-products | read-only | {style, color?, size?} |
check-inventory | read-only | {style, color, size, auto_resolve_color?} |
get-pricing | read-only | {lines: [{style, color, size}, ...], auto_resolve_color?} |
validate-cart | read-only | {purchase_order: {...}} (pre-submit, no commit) |
create-purchase-order | high — external write | {purchase_order: {...}, confirm} |
check-order-status | read-only | {po_number} |
get-tracking | read-only | {po_number} |
cancel-order | stub | {po_number, reason?, confirm?} — SanMar exposes no public cancel endpoint |
parse-po-pdf | read-only (local file) | {pdf_path} |
lookup-mainframe-color | read-only (SFTP) | {style, color, size?, force_refresh?} |
Run python3 scripts/sanmar.py with no action to print the full action list.
See references/examples.md for realistic prompts and
end-to-end flows.
Credentials
SanMar SOAP requests carry three fields: sanMarCustomerNumber,
sanMarUserName, sanMarUserPassword. PromoStandards (order shipment) reuses
the same username/password in its SOAP header.
The skill never hardcodes credentials. Supply them in either of two ways:
-
Environment variables (preferred for a deployed agent):
SANMAR_CUSTOMER_NUMBER=... SANMAR_USERNAME=... SANMAR_PASSWORD=... SANMAR_ENV=production # or "development" — flips PO submit to test-ws # SFTP (only for mainframe-color resolution; separate password): SANMAR_FTP_USERNAME= # defaults to SANMAR_CUSTOMER_NUMBER SANMAR_FTP_PASSWORD=... -
Inline in the stdin JSON — pass
customer_number,username,password,environment, and (for SFTP tools)ftp_passwordalongside the tool's own arguments. Inline values take precedence over the environment.
If neither is present, the tool exits with
{"error": {"type": "config_error", ...}} (exit code 2) — treat that as a
signal to ask the user for the missing fields. Do not guess defaults, reuse
credentials across tenants, or paste secrets the user did not provide.
FTP credentials are separate. Per SanMar's FTP Integration Guide v23.1, the SDL feed lives on
ftp.sanmar.com:2200over SFTP (SSH), and the FTP password is issued separately from the web-services password — yoursanmar.comweb username will not work on the FTP server.
Write safety
create-purchase-order and cancel-order are the only side-effecting actions.
create-purchase-orderrequires"confirm": trueto transmit. Without it, it returns a dry-run preview of the SOAP envelope and makes no submit call. Normal flow:get-pricing(to enrich each line withinventory_keyandsize_index) →validate-cart(proceed only ifok) →create-purchase-orderwithconfirm: true. Confirm with the user first.cancel-orderis a reserved stub: SanMar's published SOAP and PromoStandards bindings expose no cancel operation, so it always returns a structurednot_implementedresponse. Cancellations go through SanMar customer service.
All other actions are pure reads.
PDF purchase-order intake
parse-po-pdf takes {"pdf_path": "..."} and returns a best-effort
ParsedPurchaseOrder: po_number, order_date, ship_method, ship_to,
lines[] (style, color, size, quantity, unit_price), warnings[]
for low-confidence fields, and draft_for_submit — a ready-to-pass
purchase_order object for create-purchase-order, populated only when the
parse is complete enough. Always show the parsed PO back to the user for
approval before submitting. Heuristic parsing cannot guarantee correctness
across every PO layout — treat the output as a draft.
Mainframe color resolution
SanMar's inventory/pricing/PO endpoints query against the mainframe color
code (e.g. ATHHTHR), not the marketing COLOR_NAME (Athletic Heather).
When a marketing name is used, SanMar typically errors or returns nothing.
check-inventory and get-pricing auto-handle this: on error or an empty
response (and with auto_resolve_color defaulting to true) they download
SanMarPDD/SanMar_SDL_N.csv over SFTP, look up the matching
SANMAR_MAINFRAME_COLOR, and retry once. Pass auto_resolve_color: false when
you already have a known mainframe code. For explicit control, call
lookup-mainframe-color directly — its status is matched, ambiguous, or
not_found. The SDL CSV is cached locally for 24h (SanMar refreshes nightly);
pass force_refresh: true to bypass the cache.
Endpoints
Production (default):
- Pricing —
SanMarWebService/SanMarPricingServicePort - Product info —
SanMarWebService/SanMarProductInfoServicePort - Inventory —
SanMarWebService/SanMarWebServicePort - PO submit —
SanMarWebService/SanMarPOServicePort - Order shipment —
promostandards/OrderShipmentNotificationServiceBinding
With SANMAR_ENV=development, the PO submit endpoint switches to
https://test-ws.sanmar.com:8080/SanMarWebService/SanMarPOServicePort.
SanMar must allowlist the calling IP. A connection timeout is most often a missing IP allowlist entry, not an auth problem.
Error model
Failures print {"error": {...}} and exit non-zero:
config_error(exit 2) — missing/invalid credentials.api_error— SanMar returned a SOAP fault orerrorOccurred=true. Includessurface,operation, andretryable.retryableisfalsefor auth, schema, and invalid-style errors.connection_error— network/timeout talking to SanMar or its SFTP server (retryable: truefor web-service transport failures).validation_error— bad input JSON, a missing required field, or an unparseable PDF.usage/unknown_action(exit 2) — bad CLI invocation; the message lists the validactions.
Surface the human-readable message to the user. Do not retry on
config_error, validation_error, or a non-retryable api_error.
References
references/examples.md— realistic agent prompts and end-to-end flows.references/web_services.md— SOAP service details (pricing, product info, inventory, PO submit).references/purchase_orders.md— PO submit payload shape and the pre-submit/enrichment flow.references/ftp_feeds.md— the SDL CSV feed and mainframe-color resolution.references/auth_and_patterns.md— auth fields and calling patterns.
相关技能
Config-driven PromoStandards client for any supplier that publishes the standard SOAP services — inventory (per-warehouse stock), product data (styles, colors, sizes, parts), pricing and configuration (quantity breaks, decoration locations, FOB points, charges), and purchase-order submission. One skill serves every supplier, because endpoints, versions and credentials come from configuration derived from the public PromoStandards endpoint registry, so onboarding a new supplier is data entry rather than code. Per-version adapters handle the incompatible spellings between service versions (Inventory 1.2.1 vs 2.0.0, Product Data 1.0.0 vs 2.0.0) and normalise everything to one canonical shape. Use whenever the user needs stock, product, pricing or ordering data from a promotional-products supplier, or wants to know which PromoStandards services a supplier actually supports.
CHAMPRO supplier toolkit covering everything CHAMPRO's PromoStandards services cannot reach — per-warehouse inventory (CHAMPRO publishes no INV endpoint at any version), order status and package tracking (no ODRSTAT, no OSN), ordering with a real sandbox (CHAMPRO registers no PromoStandards PO test endpoint, so the generic client refuses to send), decorated team orders with rosters and proof files, MOQ increments and lead-time catalogs, warehouse routing with split-shipment suborders, and the Custom Builder web-to-print flow (design sessions, proof/view downloads, order-from-design). JSON-in/JSON-out CLI actions over CHAMPRO's REST API and Custom Builder API, with local pre-flight that catches the documented rejections before an order is sent and a hard escalation path for partially-placed orders. Use for CHAMPRO stock or custom apparel sourcing, inventory, ordering, tracking, or Custom Builder embedding — and keep using the promostandards skill for CHAMPRO product data and pricing.
SamCart (samcart.com). Use this skill for ANY SamCart request — reading, creating, and updating data. Whenever a task involves SamCart, use this skill instead of calling the API directly.
Researches Sam's Club's catalog — department/category navigation, category product grids, product detail with pricing/availability/ratings, related-item shelves, and curated content pages — using the Crawlora API, returning clean JSON. Use when the user asks to browse Sam's Club departments, list a Sam's Club category's products, look up a Sam's Club product's price/rating, or find items related to a Sam's Club product — instead of scraping samsclub.com.
通过单一 MCP 连接获取多承运商实时运费、校验地址,并购买国内或国际运单。