A JavaScript client for BigCommerce's Management API with full TypeScript typings for all API endpoints.
- Full coverage and Typescript typing for BigCommerce's Management REST APIs
- Easy IDE autocompeletion of endpoints, parameters and response data
- Automatic retry of intermittent errors such as 429 and 5xx with exponential backoff
- Node.js >=18
To get started with the JavaScript client you'll need to install it, and then follow the instructions for either the Storefront API client or the Management API client.
npm install @aligent/bigcommerce-api
Management REST API schemas are taken from the BigCommerce documentation here: https://github.com/bigcommerce/docs/tree/main/reference
REST methods not declared in a schema are by default included in openapi-typescript with a value of never
.
To improve UX and reduce complexity at compile time these methods are removed from the built types.
Almost all requests require a value of application/json
for these headers - the exception being methods supporting multipart/form-data
(e.g. image uploads).
For ease of use the exported client automatically sets the appropriate headers, and the required types are instead set to optional in the exported types.
Some methods declare what appears to be an invalid or unnecessary additional response code with an empty object as the value for application/json
.
These are removed from the generated Typescript types as they force users to check the response type when it should never be necessary (e.g. 201 on a GET request)
The response payloads for these are incorrectly declared in BigCommerce's documentation and schemas: bigcommerce/docs#912
The generated types for these endpoints are currently incorrect as a result.
The documentation site pulls the schema for these endpoints from a different source.
This library was built on the groundwork laid by the @space48/bigcommerce-api
library (https://github.com/Space48/bigcommerce-api-js/).
BigCommerce have changed their published schemas substantially since the last time that library was built. If you are migrating, please check docs/CHANGED_PATHS.md.
Warning
There may be other changes to query, path, and response variables. Migration may require additional changes to your code.
This project strictly follows Semantic Versioning.
If you have a problem with this library, please file an issue here on GitHub.
See CONTRIBUTING.md
MIT
- Providing a different base URL (or custom fetch client) is unnecessarily difficult
- Expose the storefront API paths properly
- Regular rebuild and publish schedule to keep up with BigCommerce API schema changes
- Migrate generation code to Typescript
- Properly publish ESM and CJS exports
- Audit eslint/typescript ignore comments
- Audit type narrowing and parameter types (especially in v2)