Skip to content
SDK for interaction with Demandware Open Commerce API
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
src
test
.babelrc
.editorconfig
.eslintrc
.gitignore
.npmignore
.travis.yml
CHANGELOG.md
README.md
package-lock.json
package.json

README.md

open-commerce-sdk

Client library for interacting with SalesForce Open Commerce api.

Installation

npm install @pgprojectx/open-commerce-sdk

Usage

const ocSDK = require('@pgprojectx/open-commerce-sdk');
OpenCommerceSDK.ApiClient.instance = new OpenCommerceSDK.ApiClient({ basePath: basePath, clientId: clientId });

const productApi = new OpenCommerceSDK.Product();

development

  1. Set environment variables appropriate to running a Open Commerce deployment (see olay-api-serverless/config).

NOTE: If you do not set your environment properly, the repl will not start:

λ ./src/repl.js
> init()
missing env OC_API_HOST
missing env OC_CLIENT_ID
Error: invalid config, abort
  1. Start the repl via ./src/repl.js. Once the repl starts, you may init(), this loads two references on the repl context: config and oc:
> init()
> ProductApi
ProductApi.getProduct('075609195518').then(d => data = d);
> data
{ _v: '17.8',
  _type: 'product',
  ... }
You can’t perform that action at this time.