apimatic-woo-commerce-sdk
v1.0.0
Published
WooCommerce API is a REST API for WordPress that enables developers to manage products, orders, customers, and store settings, making it easy to build and extend custom eCommerce solutions.
Readme
Getting Started with WooCommerce REST API
Introduction
Taken from: https://github.com/woocommerce/woocommerce-rest-api-docs
Introduction
WooCommerce (WC) 2.6+ is fully integrated with the WordPress REST API. This allows WC data to be created, read, updated, and deleted using requests in JSON format and using WordPress REST API Authentication methods and standard HTTP verbs which are understood by most HTTP clients.
The current WP REST API integration version is v3 which takes a first-order position in endpoints.
The following table shows API versions present in each major version of WooCommerce:
Prior to 2.6, WooCommerce has had a REST API separate from WordPress which is now known as the legacy API. You can find the documentation for the legacy API separately.
Requirements
To use the latest version of the REST API you must be using:
- WooCommerce 3.5+.
- WordPress 4.4+.
- Pretty permalinks in
Settings > Permalinksso that the custom endpoints are supported. Default permalinks will not work. - You may access the API over either HTTP or HTTPS, but HTTPS is recommended where possible.
If you use ModSecurity and see 501 Method Not Implemented errors, see this issue for details.
Install the Package
Run the following command from your project directory to install the package from npm:
npm install [email protected]For additional package details, see the Npm page for the [email protected] npm.
Test the SDK
To validate the functionality of this SDK, you can execute all tests located in the test directory. This SDK utilizes Jest as both the testing framework and test runner.
To run the tests, navigate to the root directory of the SDK and execute the following command:
npm run testOr you can also run tests with coverage report:
npm run test:coverageInitialize the API Client
Note: Documentation for the client can be found here.
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
| environment | Environment | The API environment. Default: Environment.Production |
| timeout | number | Timeout for API calls.Default: 0 |
| httpClientOptions | Partial<HttpClientOptions> | Stable configurable http client options. |
| unstableHttpClientOptions | any | Unstable configurable http client options. |
| basicAuthCredentials | BasicAuthCredentials | The credential object for basicAuth |
The API client can be initialized as follows:
import { Client, Environment } from 'apimatic-woo-commerce-sdk';
const client = new Client({
basicAuthCredentials: {
username: 'username',
password: 'password'
},
timeout: 0,
environment: Environment.Production,
});Authorization
This API uses the following authentication schemes.
List of APIs
- Attributeid Terms
- Shippingclasses
- Productid Variations
- Groupid
- Instanceid
- Zoneid Methods
- Systemstatus
- Shippingmethods
- Paymentgateways
- Id
- Batch
- Coupons
- Customers
- Notes
- Refunds
- Orders
- Attributes
- Categories
- Reviews
- Tags
- Products
- Reports
- Settings
- Locations
- Shipping Zones
- Classes
- Taxes
- Webhooks
- Tools
- Continents
- Countries
- Currencies
- Data
