Skip to main content

A UNIX-style tool which provides easy access to BigCommerce's API from the command line.

Project description

BigCommerce Toolkit

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.

Features

  • 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.

Installation

To install BigCommerce Toolkit, clone the repository and install the necessary dependencies.

pip install bigcommerce-toolkit

Usage

Basic Command Structure

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>]

Setting Up Environment Variables

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 

Example Commands

Create a Product (via Arguments)

To create a new product with data provided as named arguments:

bigc products create --name "New Product" --price 19.99 --type physical --weight 0

Create a Product (via Standard Input)

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 -

Update a Product

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

Fetching All Products

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

Contributing

We welcome contributions to improve the project. Please submit issues and pull requests via GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bigcommerce_toolkit-0.1.10.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bigcommerce_toolkit-0.1.10-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file bigcommerce_toolkit-0.1.10.tar.gz.

File metadata

  • Download URL: bigcommerce_toolkit-0.1.10.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.2 Darwin/24.6.0

File hashes

Hashes for bigcommerce_toolkit-0.1.10.tar.gz
Algorithm Hash digest
SHA256 f3d589bd5203b310c5ebb57a5130e717a0ed81ac8eba0f5e2b737a21de6c14df
MD5 da64621587d23b2f0605df586265f8b9
BLAKE2b-256 f20858ca0be3637f914e9e2685047dced3a698a27a9e452720e5c482db9ac079

See more details on using hashes here.

File details

Details for the file bigcommerce_toolkit-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for bigcommerce_toolkit-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 0437c7e2c048e5334bcecbce8c4c90fb135701c7156b97f11b85b206c7e0ba15
MD5 5bc2a2784a0b2359ceb177593bc62ebd
BLAKE2b-256 5b890149fac6c7aa734698a1dd395abada4fcc20a40b7802fb1b9fcf4aab2c3d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page