Skip to main content
This guide shows you how to initialize the PromoStandards client and retrieve product data from a supplier.

Before you begin

Make sure you have:
  • Installed the SDK
  • Your supplier’s account ID and password
  • API endpoint URLs for the services you want to use
Contact your supplier’s support team if you need help finding your credentials or endpoint URLs.

Initialize the client

1

Import the SDK

Start by importing the PromoStandards client:
import { PromoStandards } from 'promostandards-sdk-js';
2

Create a client instance

Initialize the client with your credentials and endpoint configuration:
const supplier = new PromoStandards.Client({
  id: 'your-account-id',
  password: 'your-password',
  endpoints: [
    {
      type: 'ProductData',
      version: '2.0.0',
      url: 'https://supplier.com/productData',
    },
    {
      type: 'MediaContent',
      version: '1.1.0',
      url: 'https://supplier.com/productMedia',
    },
    {
      type: 'Inventory',
      version: '2.0.0',
      url: 'https://supplier.com/inventory',
    },
    {
      type: 'ProductPricingAndConfiguration',
      version: '1.0.0',
      url: 'https://supplier.com/pricingAndConfiguration',
    },
  ],
});
Replace the credentials and URLs with the actual values provided by your supplier. Each supplier may support different service versions.
3

Make your first API call

Use the client to retrieve product information:
const productData = await supplier.productData.getProduct({
  productId: 'item_id',
  localizationCountry: 'US',
  localizationLanguage: 'en',
});

console.log(productData);

Complete example

Here’s a full working example that demonstrates multiple API calls:
import { PromoStandards } from 'promostandards-sdk-js';

(async function main() {
  const supplier = new PromoStandards.Client({
    id: 'account_id',
    password: 'password',
    endpoints: [
      {
        type: 'ProductData',
        version: '2.0.0',
        url: 'https://supplier.com/productData',
      },
      {
        type: 'MediaContent',
        version: '1.1.0',
        url: 'https://supplier.com/productMedia',
      },
      {
        type: 'Inventory',
        version: '2.0.0',
        url: 'https://supplier.com/inventory',
      },
      {
        type: 'ProductPricingAndConfiguration',
        version: '1.0.0',
        url: 'https://supplier.com/pricingAndConfiguration',
      },
    ],
  });

  // Get product details
  const productData = await supplier.productData.getProduct({
    productId: 'item_id',
    localizationCountry: 'US',
    localizationLanguage: 'en',
  });

  // Get product images and media
  const mediaContentData = await supplier.mediaContent.getMediaContent({
    mediaType: 'Image',
    productId: 'item_id',
    classType: 1006,
  });

  // Check inventory levels
  const inventoryData = await supplier.inventory.getInventoryLevels({
    productId: 'item_id',
  });

  // Get pricing and configuration options
  const productPricingAndConfigurationData =
    await supplier.productPricingAndConfiguration.getConfigurationAndPricing({
      productId: 'item_id',
      currency: 'USD',
      priceType: 'Customer',
      fobId: 1,
    });

  console.log(
    JSON.stringify(
      {
        productData,
        mediaContentData,
        inventoryData,
        productPricingAndConfigurationData,
      },
      null,
      2
    )
  );
})();

Understanding the example

Let’s break down what each API call does:

Product Data

const productData = await supplier.productData.getProduct({
  productId: 'item_id',
  localizationCountry: 'US',
  localizationLanguage: 'en',
});
Retrieves detailed product information including descriptions, specifications, colors, and sizes. Reference: PromoStandards Product Data 2.0.0

Media Content

const mediaContentData = await supplier.mediaContent.getMediaContent({
  mediaType: 'Image',
  productId: 'item_id',
  classType: 1006,
});
Fetches product images and other media assets. Use classType to specify the type of image (e.g., 1006 for product images). Reference: PromoStandards Media Content 1.1.0

Inventory

const inventoryData = await supplier.inventory.getInventoryLevels({
  productId: 'item_id',
});
Checks real-time inventory availability for a product. Reference: PromoStandards Inventory 2.0.0

Pricing and Configuration

const pricingData =
  await supplier.productPricingAndConfiguration.getConfigurationAndPricing({
    productId: 'item_id',
    currency: 'USD',
    priceType: 'Customer',
    fobId: 1,
  });
Retrieves pricing information and available decoration configurations. Reference: PromoStandards Product Pricing and Configuration 1.0.0

Next steps

Client configuration

Learn about advanced client configuration options

Response formats

Choose between XML and JSON response formats

Error handling

Handle API errors and exceptions gracefully

API Reference

Explore the complete API documentation

Build docs developers (and LLMs) love