SDKs overview
BigCommerce provides Software Development Kits (SDKs) to facilitate interaction with its suite of APIs, including the Storefront, Catalog, and Customer APIs. These SDKs abstract much of the complexity involved in making direct HTTP requests, handling authentication, and parsing responses, allowing developers to focus on application logic rather than API mechanics. The availability of SDKs across popular programming languages supports a wide range of development projects, from custom storefronts and headless commerce implementations to backend integrations and administrative tools.
The use of SDKs can accelerate development cycles by offering pre-built functions for common operations, consistent error handling, and language-specific conventions. This approach is particularly beneficial for projects requiring frequent interaction with the BigCommerce platform, such as synchronizing product data, managing customer information, or processing orders programmatically. BigCommerce maintains official SDKs for several languages, alongside contributions from the developer community.
Official SDKs by language
BigCommerce offers official SDKs for popular programming languages. These SDKs are designed to provide a consistent and documented interface for interacting with the BigCommerce API. Each SDK typically includes client libraries for various API endpoints, authentication helpers, and utility functions.
The table below summarizes the official SDKs, their corresponding package names, and typical installation commands. Developers can consult the BigCommerce SDKs documentation for detailed usage instructions and API coverage for each language.
| Language | Package Name | Installation Command | Maturity |
|---|---|---|---|
| PHP | bigcommerce/api-php-client |
composer require bigcommerce/api-php-client |
Stable |
| Node.js | @bigcommerce/api-nodejs-client |
npm install @bigcommerce/api-nodejs-client |
Stable |
| Python | bigcommerce |
pip install bigcommerce |
Stable |
| Ruby | bigcommerce-api |
gem install bigcommerce-api |
Stable |
Installation
Installing a BigCommerce SDK typically involves using the package manager specific to the programming language. The following sections provide general installation instructions for the officially supported languages. Prior to installation, ensure that the appropriate language runtime and package manager are set up in your development environment.
PHP SDK Installation
The BigCommerce PHP SDK is installed via Composer, the dependency manager for PHP. Ensure Composer is installed on your system.
composer require bigcommerce/api-php-client
Node.js SDK Installation
For Node.js projects, the SDK is available through npm (Node Package Manager). Navigate to your project directory and run:
npm install @bigcommerce/api-nodejs-client
Alternatively, if you use Yarn:
yarn add @bigcommerce/api-nodejs-client
Python SDK Installation
The Python SDK can be installed using pip, the Python package installer.
pip install bigcommerce
Ruby SDK Installation
Ruby projects use RubyGems to manage dependencies. Install the SDK by running:
gem install bigcommerce-api
Quickstart example
This quickstart example demonstrates how to use the BigCommerce Node.js SDK to retrieve a list of products. Before running this code, ensure you have installed the Node.js SDK and have your API credentials (client ID, access token, and store hash).
First, create a .env file in your project root to store sensitive credentials:
BIGCOMMERCE_CLIENT_ID=YOUR_CLIENT_ID
BIGCOMMERCE_ACCESS_TOKEN=YOUR_ACCESS_TOKEN
BIGCOMMERCE_STORE_HASH=YOUR_STORE_HASH
Install dotenv to load these variables:
npm install dotenv
Next, create a JavaScript file (e.g., getProducts.js) and add the following code:
require('dotenv').config();
const BigCommerce = require('@bigcommerce/api-nodejs-client');
const bigCommerce = new BigCommerce({
clientId: process.env.BIGCOMMERCE_CLIENT_ID,
accessToken: process.env.BIGCOMMERCE_ACCESS_TOKEN,
storeHash: process.env.BIGCOMMERCE_STORE_HASH,
responseType: 'json',
apiVersion: 'v3'
});
async function getProducts() {
try {
const response = await bigCommerce.get('/catalog/products');
console.log('Products:', response.data);
} catch (error) {
console.error('Error fetching products:', error.response ? error.response.data : error.message);
}
}
getProducts();
To run this example, execute the file from your terminal:
node getProducts.js
This script initializes the BigCommerce client with your credentials and then makes a GET request to the /catalog/products endpoint. The response, containing product data, is then logged to the console. This basic setup can be extended to interact with other BigCommerce API endpoints for various operations like creating products, updating orders, or managing customers. Developers can refer to the BigCommerce API Reference for available endpoints and request/response structures.
For authentication, BigCommerce APIs primarily use OAuth 2.0. The SDKs generally handle the token exchange process. Further details on API authentication methods can be found in the BigCommerce API Authentication guide. Understanding secure API key management, as outlined by organizations like the IETF's OAuth Security Topics, is crucial for production environments.
Community libraries
Beyond the officially supported SDKs, the BigCommerce developer ecosystem includes a variety of community-contributed libraries and tools. These resources, often shared on platforms like GitHub, can offer alternative approaches, specialized functionalities, or support for additional programming languages not covered by the official SDKs.
Community libraries can range from simple API wrappers to more complex frameworks designed for specific use cases, such as headless storefront development with particular frontend technologies. While these libraries can provide flexibility and innovative solutions, developers should exercise due diligence when incorporating them into projects. This includes reviewing their documentation, checking for active maintenance, assessing their compatibility with the latest BigCommerce API versions, and verifying their security practices.
Key considerations for evaluating community-contributed tools:
- Maintenance status: Check the project's commit history and issue tracker for recent activity.
- Documentation: Adequate documentation is crucial for understanding how to use the library and its limitations.
- Community support: A strong community can provide assistance and contribute to ongoing improvements.
- Security: Verify that the library adheres to security best practices, especially when handling sensitive data or API credentials.
- Compatibility: Ensure the library is compatible with the BigCommerce API version your project targets.
The official BigCommerce developer documentation and community forums are good starting points for discovering and evaluating community-contributed resources. Engaging with the wider developer community can also provide insights into the effectiveness and reliability of these third-party tools for specific project requirements.