TypeScript client for the Ecwid E-commerce REST API
npm install ecwid-api-clientjavascript
import {Ecwid} from "ecwid-api-client";
const ecwidConfig = {
apiToken: "secret_12345",
apiStoreId: "123456"
}
const ecwid = new Ecwid(ecwidConfig);
const productSearch = await ecwid.products.getAll();
if (productSearch.total > 0) {
productSearch.items.forEach((product) =>
console.log(product.name));
}
`
List of endpoints and commands enabled:
`
* Ecwid.customers
* add(Partial) => CreateStatus
* delete(customerId) => DeleteStatus
* getAll() => SearchResult (result.items contains customer array);
* getById(customerId) => Customer
* getByKeyword("keyword") => SearchResult
* getByParams({keyword: "keyword"}) => SearchResult
* update(Partial) => UpdateStatus
* Ecwid.orders
* add(Partial) => CreateStatus
* delete(orderId) => DeleteStatus
* getAll() => SearchResult (result.items contains OrderEntry array);
* getById(orderId) => OrderEntry
* getByKeyword("keyword") => SearchResult
* getByParams({keyword: "keyword"}) => SearchResult
* update(Partial) => UpdateStatus
* Ecwid.products
* add(Partial) => CreateStatus
* delete(productId) => DeleteStatus
* getAll() => SearchResult (result.items contains Product array);
* getById(productId) => Product
* getByKeyword("keyword") => SearchResult
* getByParams({keyword: "keyword"}) => SearchResult
* update(Partial) => UpdateStatus
* Ecwid.producttypes
* add(Partial) => CreateStatus
* delete(ProductTypeId) => DeleteStatus
* getAll() => ProductType[] (result is an array of ProductTypes);
* getById(typeId) => ProductType
* update(Partial) => UpdateStatus
``