DIY Developer Guide: Building Custom Integrations for SanMar

Overview

SanMar is a leading supplier of wholesale apparel and accessories, offering businesses a wide range of products through a B2B platform and robust EDI and API services. This DIY Developer Guide for SanMar provides a clear, actionable framework for building secure, scalable, and efficient custom integrations with eCommerce platforms, ERP systems, and inventory management solutions.


Prerequisites for SanMar Integrations

  • SanMar EDI/API documentation and access credentials
  • API Key, FTP credentials, or VAN setup (for EDI)
  • Familiarity with:
    • RESTful APIs or EDI standards (X12, EDIFACT)
    • JSON, XML, or Flat File data structures
  • Tools: Postman, EDI Translators, API Client Libraries (Python, Node.js)

Step 1: Authentication for SanMar Integrations

SanMar offers both API and EDI-based integration methods.

API Authentication Example:

Authorization: ApiKey YOUR_API_KEY

EDI Example:

  • Use secure FTP (SFTP) to send/receive documents like 850 (Purchase Orders) and 856 (Ship Notices).

Step 2: Endpoint Discovery and Data Mapping

Common API/EDI Resources:

  • Product Catalog (Inventory Updates)
  • Orders (Purchase Orders)
  • Order Acknowledgments
  • Advance Ship Notices (ASN)
  • Invoices

Process:

  • Review SanMar’s documentation for API endpoints or EDI transaction sets.
  • Map ERP or eCommerce fields (e.g., SKU, Quantity, Order Number) to SanMar’s data requirements.

Important considerations:

  • SKU and product code matching
  • Unit of measure consistency (e.g., pieces, dozens)
  • Accurate address formatting for orders and shipments

Step 3: Building Integration Workflows

Integration Patterns:

  • Inbound (to SanMar): Place orders, update customer information.
  • Outbound (from SanMar): Retrieve inventory availability, order acknowledgments, ASNs, and invoices.

Example: Placing an Order via API

POST /api/orders
{
  "orderNumber": "ORDER12345",
  "customerId": "CUST001",
  "items": [
    { "sku": "SAN123", "quantity": 12 }
  ]
}

Example: Retrieving Inventory Availability

GET /api/inventory/available
Authorization: ApiKey YOUR_API_KEY

Step 4: Error Handling and Pagination

Error Handling:

  • Capture API status codes and SanMar-specific error messages.
  • Retry logic for transient server (5xx) errors or rate limiting (429) responses.

Pagination:

  • Use page and pageSize parameters to handle large data sets efficiently.

Example:

GET /api/products?page=2&pageSize=100

Step 5: Testing and Validation

  • Use Postman or EDI testing tools to validate each integration workflow.
  • Confirm proper order placements, inventory syncing, and ASN generation.
  • Conduct load testing for high-volume order and inventory transactions.

Step 6: Deployment and Security

  • Deploy integrations securely using cloud services (AWS, Azure, GCP).
  • Store API Keys and FTP credentials securely with encryption.
  • Enforce HTTPS/TLS for API traffic and secure FTP protocols for EDI.
  • Implement logging, monitoring, and real-time error alerting.

Step 7: Maintenance and Monitoring

  • Monitor SanMar API or EDI service updates.
  • Set up real-time alerts for failed transactions or downtime.
  • Track KPIs like inventory sync accuracy, order processing success rates, and shipment timelines.

Optional Enhancements

  • Middleware solutions (Celigo, MuleSoft, Boomi) for broader integration needs.
  • Dashboards for real-time inventory visibility and order tracking.
  • Event-driven notifications (webhooks or EDI acknowledgments) for order status changes.

Summary

Building custom SanMar integrations helps businesses automate product catalog syncing, streamline wholesale ordering, and enhance fulfillment workflows. This DIY Developer Guide for SanMar offers a secure, scalable framework for high-performance integrations that drive operational efficiency.


Apiworx is dedicated to helping eCommerce businesses scale faster than ever possible before by streamlining and managing complex OmniChannel data flows, we save our customers time and money, allowing them to scale their businesses faster and more effectively.  We focus on automation and integration of often-overlooked back-office systems and processes such as order and inventory management.   We work with major partners in the industry and build best-in-breed automation and integration solutions.