Salesforce Commerce Cloud OCAPI Client
_______________________________________________________________________________________________________________________________________________________
+ Salesforce Commerce Cloud OCAPI Client
+_______________________________________________________________________________________________________________________________________________________
/ / , / ,
----__----__---_--_---_--_----__---)__----__----__----__---/----__-----------__-/--------__----__----__------__------------__---/--------__----__--_/_-
/ ' / ) / / ) / / ) /___) / ) / ' /___) / ' / / ) / / / / / ) / ' / ) / ) / / ' / / /___) / ) /
_(___ _(___/_/_/__/_/_/__/_(___ _/_____(___ _(___ _(___ _/___(___/_(___(__(___/_______(___/_(___ _(___(___/___/_/_______(___ _/___/___(___ _/___/_(_ __
/
- /
+ /
+
+
-🙌 Introduction
Salesforce Commerce Cloud Open Commerce API (OCAPI) for Node and browsers.
+🙌 Introduction
+Salesforce Commerce Cloud Open Commerce API (OCAPI) for Node and browsers.
- API version: 17.8
⚒ Installation
This library is distributed on npm, in order to add it as a dependency, run the following command:
-npm install commercecloud-ocapi-client --save🔦 Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: +
⚒ Installation
+This library is distributed on npm, in order to add it as a dependency, run the following command:
+npm install commercecloud-ocapi-client --save
+
+🔦 Webpack Configuration
+Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
@@ -68,7 +76,11 @@ ⚒ Installation
This library is distributed on npm, in order to add
}
}
]
-}
👨🏻💻 Getting Started
💡 Usage
Please follow the installation instruction and execute the following JS code:
+} + +👨🏻💻 Getting Started
+💡 Usage
+Please follow the installation instruction and execute the following JS code:
import ShopApi from 'commercecloud-ocapi-client'
ShopApi.ApiClient.instance = new ShopApi.ApiClient()
@@ -81,7 +93,10 @@ ⚒ Installation
This library is distributed on npm, in order to add
})
.catch((fault) => {
console.error(fault)
- })
🔌 Configuration
The API client accepts an configuration object, example:
+ }) + +🔌 Configuration
+The API client accepts an configuration object, example:
import ShopApi from 'commercecloud-ocapi-client'
const config = {
@@ -90,9 +105,13 @@ ⚒ Installation
This library is distributed on npm, in order to add
timeout: 60000, // Request timeout in milliseconds
cache: true, // If set to false an additional timestamp parameter is added to all API GET calls to prevent browser caching
enableCookies: false, //If set to true, the client will save the cookies from each server response, and return them in the next request.
+ overrideHttpPut: true // If set to true, any methods specified as using http PUT will be sent using POST along the header value 'x-dw-http-method-override' set to 'PUT'.
}
-ShopApi.ApiClient.instance = new ShopApi.ApiClient(config)
🔐 Authorization
To access secure end points, you can pass the username, password in the configuration, example:
+ShopApi.ApiClient.instance = new ShopApi.ApiClient(config) + +🔐 Authorization
+To access secure end points, you can pass the username, password in the configuration, example:
import ShopApi from 'commercecloud-ocapi-client'
const config = {
@@ -100,27 +119,39 @@ ⚒ Installation
This library is distributed on npm, in order to add
clientPassword: 'password',
}
-ShopApi.ApiClient.instance = new ShopApi.ApiClient(config)
Or to use oAuth token:
+ShopApi.ApiClient.instance = new ShopApi.ApiClient(config) + +Or to use oAuth token:
import ShopApi from 'commercecloud-ocapi-client'
const config = {
oauth2AccessToken: 'token'
}
-ShopApi.ApiClient.instance = new ShopApi.ApiClient(config)✅ Testing
Because Salesforce OCAPI is not publicly available, you need to have a running instance that you can test against. In the test folder, there is a file config.json that has the example configuration for your environment. Simply update the file with your instance information
Example:
+ShopApi.ApiClient.instance = new ShopApi.ApiClient(config) + +✅ Testing
+Because Salesforce OCAPI is not publicly available, you need to have a running instance that you can test against. In the test folder, there is a file config.json that has the example configuration for your environment. Simply update the file with your instance information
Example:
{
"clientId": "5640cc6b-f5e9-466e-9134-9853e9f9db93",
"baseUrl": "https://localhost/s/siteId/dw/shop/v17_8"
-}Then run the following command:
-npm test♻️ Continuous Integration
We use Circle CI to protect the develop and master branch to make sure the builds follows the code style and passes all tests. For every pull request, it is required to pass ALL checks including the following tests:
Then run the following command:
+npm test
+
+♻️ Continuous Integration
+We use Circle CI to protect the develop and master branch to make sure the builds follows the code style and passes all tests. For every pull request, it is required to pass ALL checks including the following tests:
- Linting:
npm run lint - Unit Tests:
npm run test
📦 Build and Deployment
At Mobify, we practice several branching strategies, Release Deployment is a strategy for projects where feature gets bundled into a release periodically. master contains the code for current version, develop has the features that is under development and waiting to be released. For new features and bug fixes, please propose pull requests to merge into develop.
📦 Build and Deployment
+At Mobify, we practice several branching strategies, Release Deployment is a strategy for projects where feature gets bundled into a release periodically. master contains the code for current version, develop has the features that is under development and waiting to be released. For new features and bug fixes, please propose pull requests to merge into develop.
This package is distributed on npm, on every release, we run scripts to automatically merge develop into master, test the build in Circle CI as well as publish the package on NPM.
Changelog
To understand the change between versions, please read CHANGELOG.md. Note that it is required to have a # To be released section filled out if you are planning to make pull requests that include new features or bug fixes.
Changelog
+To understand the change between versions, please read CHANGELOG.md. Note that it is required to have a # To be released section filled out if you are planning to make pull requests that include new features or bug fixes.
Example:
## To be released
- Update npm package to ship with three builds: `UMD`, `CommonJS` and `ES2015` [#4](https://github.com/mobify/commercecloud-ocapi-client/pull/4)
@@ -128,12 +159,17 @@ Changelog
📖 Documentation
-
+...
+
+
- @jeremywiebe
- @bendvc
- @kevinxh @@ -148,13 +184,13 @@
📖 Documentation
+ -👥 Owner
This project is open sourced and actively maintained by Mobify. +
👥 Owner
+This project is open sourced and actively maintained by Mobify. We will make an effort to support the library, but we reserve the right to make incompatible changes when necessary.
-🏅 Contributors
-
+
🏅 Contributors
+🏅 Contributors
diff --git a/docs/index.js.html b/docs/index.js.html index cb9b23e..8684cf1 100644 --- a/docs/index.js.html +++ b/docs/index.js.html @@ -1131,13 +1131,13 @@
Source: index.js
diff --git a/docs/models_AuthRequest.js.html b/docs/models_AuthRequest.js.html index 0d311c2..bf6edc8 100644 --- a/docs/models_AuthRequest.js.html +++ b/docs/models_AuthRequest.js.html @@ -127,13 +127,13 @@
Source: models/AuthRequest.js
diff --git a/docs/models_Basket.js.html b/docs/models_Basket.js.html index 4f6d63f..41d995a 100644 --- a/docs/models_Basket.js.html +++ b/docs/models_Basket.js.html @@ -462,13 +462,13 @@
Source: models/Basket.js
diff --git a/docs/models_BasketPaymentInstrumentRequest.js.html b/docs/models_BasketPaymentInstrumentRequest.js.html index 73c6851..563f153 100644 --- a/docs/models_BasketPaymentInstrumentRequest.js.html +++ b/docs/models_BasketPaymentInstrumentRequest.js.html @@ -150,13 +150,13 @@
Source: models/BasketPaymentInstrumentRequest.js
diff --git a/docs/models_BasketsResult.js.html b/docs/models_BasketsResult.js.html index dbe13dd..43eb65d 100644 --- a/docs/models_BasketsResult.js.html +++ b/docs/models_BasketsResult.js.html @@ -103,13 +103,13 @@
Source: models/BasketsResult.js
diff --git a/docs/models_BonusDiscountLineItem.js.html b/docs/models_BonusDiscountLineItem.js.html index 3908841..a1848a7 100644 --- a/docs/models_BonusDiscountLineItem.js.html +++ b/docs/models_BonusDiscountLineItem.js.html @@ -131,13 +131,13 @@
Source: models/BonusDiscountLineItem.js
diff --git a/docs/models_BoolFilter.js.html b/docs/models_BoolFilter.js.html index e9bf3f2..da6e6f1 100644 --- a/docs/models_BoolFilter.js.html +++ b/docs/models_BoolFilter.js.html @@ -130,13 +130,13 @@
Source: models/BoolFilter.js
diff --git a/docs/models_BoolQuery.js.html b/docs/models_BoolQuery.js.html index c6a1ed4..3a4f8ed 100644 --- a/docs/models_BoolQuery.js.html +++ b/docs/models_BoolQuery.js.html @@ -116,13 +116,13 @@
Source: models/BoolQuery.js
diff --git a/docs/models_BundledProduct.js.html b/docs/models_BundledProduct.js.html index 7480d47..7a06635 100644 --- a/docs/models_BundledProduct.js.html +++ b/docs/models_BundledProduct.js.html @@ -112,13 +112,13 @@
Source: models/BundledProduct.js
diff --git a/docs/models_Category.js.html b/docs/models_Category.js.html index 82b6bfb..b965fe4 100644 --- a/docs/models_Category.js.html +++ b/docs/models_Category.js.html @@ -175,13 +175,13 @@
Source: models/Category.js
diff --git a/docs/models_CategoryResult.js.html b/docs/models_CategoryResult.js.html index 126153b..7717bf6 100644 --- a/docs/models_CategoryResult.js.html +++ b/docs/models_CategoryResult.js.html @@ -113,13 +113,13 @@
Source: models/CategoryResult.js
diff --git a/docs/models_Content.js.html b/docs/models_Content.js.html index 7465053..ab60ed1 100644 --- a/docs/models_Content.js.html +++ b/docs/models_Content.js.html @@ -140,13 +140,13 @@
Source: models/Content.js
diff --git a/docs/models_ContentFolder.js.html b/docs/models_ContentFolder.js.html index 659da5d..56d1566 100644 --- a/docs/models_ContentFolder.js.html +++ b/docs/models_ContentFolder.js.html @@ -158,13 +158,13 @@
Source: models/ContentFolder.js
diff --git a/docs/models_ContentFolderResult.js.html b/docs/models_ContentFolderResult.js.html index 4d98f07..d911bf3 100644 --- a/docs/models_ContentFolderResult.js.html +++ b/docs/models_ContentFolderResult.js.html @@ -113,13 +113,13 @@
Source: models/ContentFolderResult.js
diff --git a/docs/models_ContentResult.js.html b/docs/models_ContentResult.js.html index ed5db28..f310485 100644 --- a/docs/models_ContentResult.js.html +++ b/docs/models_ContentResult.js.html @@ -113,13 +113,13 @@
Source: models/ContentResult.js
diff --git a/docs/models_ContentSearchRefinement.js.html b/docs/models_ContentSearchRefinement.js.html index 596dfc6..9416774 100644 --- a/docs/models_ContentSearchRefinement.js.html +++ b/docs/models_ContentSearchRefinement.js.html @@ -113,13 +113,13 @@
Source: models/ContentSearchRefinement.js
diff --git a/docs/models_ContentSearchRefinementValue.js.html b/docs/models_ContentSearchRefinementValue.js.html index c32de33..2c81ed4 100644 --- a/docs/models_ContentSearchRefinementValue.js.html +++ b/docs/models_ContentSearchRefinementValue.js.html @@ -139,13 +139,13 @@
Source: models/ContentSearchRefinementValue.js
diff --git a/docs/models_ContentSearchResult.js.html b/docs/models_ContentSearchResult.js.html index 9d2b812..0c1302b 100644 --- a/docs/models_ContentSearchResult.js.html +++ b/docs/models_ContentSearchResult.js.html @@ -176,13 +176,13 @@
Source: models/ContentSearchResult.js
diff --git a/docs/models_CouponItem.js.html b/docs/models_CouponItem.js.html index b0be26d..8367bb4 100644 --- a/docs/models_CouponItem.js.html +++ b/docs/models_CouponItem.js.html @@ -201,13 +201,13 @@
Source: models/CouponItem.js
diff --git a/docs/models_CustomObject.js.html b/docs/models_CustomObject.js.html index 78ae060..e8e994d 100644 --- a/docs/models_CustomObject.js.html +++ b/docs/models_CustomObject.js.html @@ -121,13 +121,13 @@
Source: models/CustomObject.js
diff --git a/docs/models_Customer.js.html b/docs/models_Customer.js.html index b30d771..f553a3e 100644 --- a/docs/models_Customer.js.html +++ b/docs/models_Customer.js.html @@ -398,13 +398,13 @@
Source: models/Customer.js
diff --git a/docs/models_CustomerAddress.js.html b/docs/models_CustomerAddress.js.html index 2dd7a1b..d5df303 100644 --- a/docs/models_CustomerAddress.js.html +++ b/docs/models_CustomerAddress.js.html @@ -328,13 +328,13 @@
Source: models/CustomerAddress.js
diff --git a/docs/models_CustomerAddressLink.js.html b/docs/models_CustomerAddressLink.js.html index b1ac41d..2520959 100644 --- a/docs/models_CustomerAddressLink.js.html +++ b/docs/models_CustomerAddressLink.js.html @@ -112,13 +112,13 @@
Source: models/CustomerAddressLink.js
diff --git a/docs/models_CustomerAddressResult.js.html b/docs/models_CustomerAddressResult.js.html index 2dcb9aa..aba4416 100644 --- a/docs/models_CustomerAddressResult.js.html +++ b/docs/models_CustomerAddressResult.js.html @@ -149,13 +149,13 @@
Source: models/CustomerAddressResult.js
diff --git a/docs/models_CustomerInfo.js.html b/docs/models_CustomerInfo.js.html index 9c7039a..9cff599 100644 --- a/docs/models_CustomerInfo.js.html +++ b/docs/models_CustomerInfo.js.html @@ -122,13 +122,13 @@
Source: models/CustomerInfo.js
diff --git a/docs/models_CustomerOrderResult.js.html b/docs/models_CustomerOrderResult.js.html index 6821115..163b0cd 100644 --- a/docs/models_CustomerOrderResult.js.html +++ b/docs/models_CustomerOrderResult.js.html @@ -149,13 +149,13 @@
Source: models/CustomerOrderResult.js
diff --git a/docs/models_CustomerPaymentCardRequest.js.html b/docs/models_CustomerPaymentCardRequest.js.html index f1b6667..0fa9f6e 100644 --- a/docs/models_CustomerPaymentCardRequest.js.html +++ b/docs/models_CustomerPaymentCardRequest.js.html @@ -166,13 +166,13 @@
Source: models/CustomerPaymentCardRequest.js
diff --git a/docs/models_CustomerPaymentInstrument.js.html b/docs/models_CustomerPaymentInstrument.js.html index 01473c3..6a4e179 100644 --- a/docs/models_CustomerPaymentInstrument.js.html +++ b/docs/models_CustomerPaymentInstrument.js.html @@ -159,13 +159,13 @@
Source: models/CustomerPaymentInstrument.js
diff --git a/docs/models_CustomerPaymentInstrumentRequest.js.html b/docs/models_CustomerPaymentInstrumentRequest.js.html index 763edce..68dc9b9 100644 --- a/docs/models_CustomerPaymentInstrumentRequest.js.html +++ b/docs/models_CustomerPaymentInstrumentRequest.js.html @@ -132,13 +132,13 @@
Source: models/CustomerPaymentInstrumentRequest.js
diff --git a/docs/models_CustomerPaymentInstrumentResult.js.html b/docs/models_CustomerPaymentInstrumentResult.js.html index d706a05..7ad00f1 100644 --- a/docs/models_CustomerPaymentInstrumentResult.js.html +++ b/docs/models_CustomerPaymentInstrumentResult.js.html @@ -113,13 +113,13 @@
Source: models/CustomerPaymentInstrumentResult.js
diff --git a/docs/models_CustomerProductList.js.html b/docs/models_CustomerProductList.js.html index bd0cd0a..31c874c 100644 --- a/docs/models_CustomerProductList.js.html +++ b/docs/models_CustomerProductList.js.html @@ -279,13 +279,13 @@
Source: models/CustomerProductList.js
diff --git a/docs/models_CustomerProductListItem.js.html b/docs/models_CustomerProductListItem.js.html index 448dc81..6d4f622 100644 --- a/docs/models_CustomerProductListItem.js.html +++ b/docs/models_CustomerProductListItem.js.html @@ -188,13 +188,13 @@
Source: models/CustomerProductListItem.js
diff --git a/docs/models_CustomerProductListItemLink.js.html b/docs/models_CustomerProductListItemLink.js.html index 4570407..f653796 100644 --- a/docs/models_CustomerProductListItemLink.js.html +++ b/docs/models_CustomerProductListItemLink.js.html @@ -103,13 +103,13 @@
Source: models/CustomerProductListItemLink.js
diff --git a/docs/models_CustomerProductListItemResult.js.html b/docs/models_CustomerProductListItemResult.js.html index 7d3f0a1..07950f6 100644 --- a/docs/models_CustomerProductListItemResult.js.html +++ b/docs/models_CustomerProductListItemResult.js.html @@ -138,13 +138,13 @@
Source: models/CustomerProductListItemResult.js
diff --git a/docs/models_CustomerProductListRegistrant.js.html b/docs/models_CustomerProductListRegistrant.js.html index ae9f787..0d7febb 100644 --- a/docs/models_CustomerProductListRegistrant.js.html +++ b/docs/models_CustomerProductListRegistrant.js.html @@ -121,13 +121,13 @@
Source: models/CustomerProductListRegistrant.js
diff --git a/docs/models_CustomerProductListResult.js.html b/docs/models_CustomerProductListResult.js.html index e8ea184..89699a7 100644 --- a/docs/models_CustomerProductListResult.js.html +++ b/docs/models_CustomerProductListResult.js.html @@ -113,13 +113,13 @@
Source: models/CustomerProductListResult.js
diff --git a/docs/models_CustomerRegistration.js.html b/docs/models_CustomerRegistration.js.html index 1c7f3b3..4492c71 100644 --- a/docs/models_CustomerRegistration.js.html +++ b/docs/models_CustomerRegistration.js.html @@ -105,13 +105,13 @@
Source: models/CustomerRegistration.js
diff --git a/docs/models_Discount.js.html b/docs/models_Discount.js.html index fd245e1..71a175a 100644 --- a/docs/models_Discount.js.html +++ b/docs/models_Discount.js.html @@ -183,13 +183,13 @@
Source: models/Discount.js
diff --git a/docs/models_Fault.js.html b/docs/models_Fault.js.html index 5581e67..34f5d85 100644 --- a/docs/models_Fault.js.html +++ b/docs/models_Fault.js.html @@ -69,6 +69,12 @@
Source: models/Fault.js
* @member {String} type */ this.type = undefined + + /** + * These are optional arguments returned with fault + * @member {Object} arguments + */ + this.arguments = undefined } /** @@ -90,6 +96,9 @@Source: models/Fault.js
if (data.hasOwnProperty('type')) { obj['type'] = ApiClient.convertToType(data['type'], 'String') } + if (data.hasOwnProperty('arguments')) { + obj['arguments'] = ApiClient.convertToType(data['arguments'], {String: Object}) + } } return obj @@ -105,13 +114,13 @@Source: models/Fault.js
diff --git a/docs/models_Filter.js.html b/docs/models_Filter.js.html index 0bc3cd6..8e62886 100644 --- a/docs/models_Filter.js.html +++ b/docs/models_Filter.js.html @@ -122,13 +122,13 @@
Source: models/Filter.js
diff --git a/docs/models_FilteredQuery.js.html b/docs/models_FilteredQuery.js.html index 888840d..aae82b6 100644 --- a/docs/models_FilteredQuery.js.html +++ b/docs/models_FilteredQuery.js.html @@ -107,13 +107,13 @@
Source: models/FilteredQuery.js
diff --git a/docs/models_GiftCertificate.js.html b/docs/models_GiftCertificate.js.html index 2278c11..09e4c9c 100644 --- a/docs/models_GiftCertificate.js.html +++ b/docs/models_GiftCertificate.js.html @@ -216,13 +216,13 @@
Source: models/GiftCertificate.js
diff --git a/docs/models_GiftCertificateItem.js.html b/docs/models_GiftCertificateItem.js.html index 0c399e0..595b35f 100644 --- a/docs/models_GiftCertificateItem.js.html +++ b/docs/models_GiftCertificateItem.js.html @@ -150,13 +150,13 @@
Source: models/GiftCertificateItem.js
diff --git a/docs/models_GiftCertificateRequest.js.html b/docs/models_GiftCertificateRequest.js.html index 29a1934..249499d 100644 --- a/docs/models_GiftCertificateRequest.js.html +++ b/docs/models_GiftCertificateRequest.js.html @@ -94,13 +94,13 @@
Source: models/GiftCertificateRequest.js
diff --git a/docs/models_Image.js.html b/docs/models_Image.js.html index 45440b3..3b2a5b8 100644 --- a/docs/models_Image.js.html +++ b/docs/models_Image.js.html @@ -117,13 +117,13 @@
Source: models/Image.js
diff --git a/docs/models_ImageGroup.js.html b/docs/models_ImageGroup.js.html index f999985..e1f3a87 100644 --- a/docs/models_ImageGroup.js.html +++ b/docs/models_ImageGroup.js.html @@ -114,13 +114,13 @@
Source: models/ImageGroup.js
diff --git a/docs/models_Inventory.js.html b/docs/models_Inventory.js.html index f17a4c0..b9c72f6 100644 --- a/docs/models_Inventory.js.html +++ b/docs/models_Inventory.js.html @@ -149,13 +149,13 @@
Source: models/Inventory.js
diff --git a/docs/models_Locale.js.html b/docs/models_Locale.js.html index 26a5c86..8b5dc9e 100644 --- a/docs/models_Locale.js.html +++ b/docs/models_Locale.js.html @@ -184,13 +184,13 @@
Source: models/Locale.js
diff --git a/docs/models_Master.js.html b/docs/models_Master.js.html index 5a56a20..5c38353 100644 --- a/docs/models_Master.js.html +++ b/docs/models_Master.js.html @@ -134,13 +134,13 @@
Source: models/Master.js
diff --git a/docs/models_NestedQuery.js.html b/docs/models_NestedQuery.js.html index 6faed9a..37db924 100644 --- a/docs/models_NestedQuery.js.html +++ b/docs/models_NestedQuery.js.html @@ -149,13 +149,13 @@
Source: models/NestedQuery.js
diff --git a/docs/models_Note.js.html b/docs/models_Note.js.html index 5d6601b..90ccbfa 100644 --- a/docs/models_Note.js.html +++ b/docs/models_Note.js.html @@ -130,13 +130,13 @@
Source: models/Note.js
diff --git a/docs/models_NotesResult.js.html b/docs/models_NotesResult.js.html index 3770a55..9419b22 100644 --- a/docs/models_NotesResult.js.html +++ b/docs/models_NotesResult.js.html @@ -95,13 +95,13 @@
Source: models/NotesResult.js
diff --git a/docs/models_Option.js.html b/docs/models_Option.js.html index 8c4adc8..4313c40 100644 --- a/docs/models_Option.js.html +++ b/docs/models_Option.js.html @@ -133,13 +133,13 @@
Source: models/Option.js
diff --git a/docs/models_OptionItem.js.html b/docs/models_OptionItem.js.html index be22fba..522237e 100644 --- a/docs/models_OptionItem.js.html +++ b/docs/models_OptionItem.js.html @@ -348,13 +348,13 @@
Source: models/OptionItem.js
diff --git a/docs/models_OptionValue.js.html b/docs/models_OptionValue.js.html index 7befdc5..1c4eda2 100644 --- a/docs/models_OptionValue.js.html +++ b/docs/models_OptionValue.js.html @@ -43,14 +43,14 @@
