BigCommerce Toolkit is a command-line interface (CLI) tool for BigCommerce's API. It follows UNIX principles of "do one thing well" and organizes commands based on resource type and action. This structure aligns with RESTful API principles, providing a logical and hierarchical system for managing various BigCommerce resources.
- Resource-based Commands: Commands are structured around resource types (e.g., products, categories, customers) and their respective actions (e.g., get, create, update, delete).
- Hierarchical Command Structure: Similar to UNIX tools like
git
, commands are grouped logically to align with BigCommerce's API structure. - Environment Variable Support: Store hash and authentication token can be set via environment variables for convenience.
- Paginated Requests: Supports fetching all pages of data for GET requests with pagination.
- Standard Input (stdin) Support: Allows reading values from stdin for easier scripting and piping data between commands.
To install BigCommerce Toolkit, clone the repository and install the necessary dependencies.
pip install bigcommerce-toolkit
The CLI uses a structure similar to UNIX commands, where you specify the resource type, action, and additional parameters or options as needed.
bigc [<options>] <resource> [<subresource>] <action> [<arguments>]
Before using the tool, set the environment variables for your BigCommerce store hash and authentication token.
export BIGCOMMERCE_STORE_HASH=your_store_hash
export BIGCOMMERCE_AUTH_TOKEN=your_auth_token
Alternatively, you can pass these values directly via command-line options.
bigc --store-hash your_store_hash --auth-token your_auth_token …
To create a new product with data provided as named arguments:
bigc products create --name "New Product" --price 19.99 --type physical --weight 0
BigCommerce Toolkit also supports reading values from stdin
, allowing for piping data between commands for easier scripting. For example:
echo '{"name": "New Product", "price": 19.99, "type": "physical", "weight": 0}' | bigc products create --data -
This can be further leveraged by piping through additional tools like jq
. First, retrieving a product's ID by the product's name, and then updating that product's price:
bigc products get --name:like "New Product" | jq -r '.data[0].id' | bigc product update --id - --price 24.99
For endpoints that support pagination, you can fetch all pages of data. Using tools like jq
and csvlook
, it is possible to format the data into a more readable format.
bigc products get-all | jq -r '["id","sku","name"], (.data[] | [.id,.sku,.name]) | @csv' | csvlook
We welcome contributions to improve the project. Please submit issues and pull requests via GitHub.