A Node.js package for Knawat Dropshipping MP REST API. Easily interact with the Knawat MP REST API using this library.
npm install --save @knawat/mp
Check out the Knawat Dropshipping MP REST API endpoints and data that can be manipulated in https://mp.knawat.io/.
Setup for the new Knawat Dropshipping REST API integration:
const MP = require('@knawat/mp');
// Provide instance with your store credentials
const mp = new MP({
key: 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
secret: 'XXXXXXXXXXXXXXXXXXXXXXXX',
});
// Or use your store id/URL
const mp = new MP({
store: 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
});
Option | Type | Required | Description |
---|---|---|---|
key |
string |
conditional | Your Store's API consumer key if token not provided this field is required |
secret |
string |
conditional | Your Store's API consumer secret if token not provided this field is required |
store |
string |
conditional | Your store current store URL |
https://knawat-mp.restlet.io/#operation_get_token
Retrieve the list of all products or products for this channel, sorted by create date DESC
mp.getProducts(limit, page, lastupdate);
Params | Type | Required | Description |
---|---|---|---|
limit |
Number |
No | Number of products to retrieve. Default: 10 |
page |
Number |
No | Number of the page to retrieve. Default: 1 |
lastupdate |
Number |
No | UTC Timestamp of last import. for get only updated products after this Timestamp |
keyword |
String |
No | Text to search in product SKU |
hideOutOfStock |
Number |
No | 1 = hide out of stock products Default: 0 |
https://knawat-mp.restlet.io/#operation_get_products
Add products to my list
mp.addProducts(products);
Option | Type | Required | Description |
---|---|---|---|
products |
array |
yes | Array of SKUs [{ sku: '1234' }] |
https://knawat-mp.restlet.io/#operation_add_to_my_products
Get in stock products count
mp.getProductsCount();
https://knawat-mp.restlet.io/#operation_products_count
Retrieve single product information by Product SKU. product should be under this store
mp.getProductBySku(sku);
Params | Type | Description |
---|---|---|
sku |
string |
SKU of Product you want to get |
https://knawat-mp.restlet.io/#operation_get_product_by_sku
Retrieve products information using bulk update. product should be under this store
mp.updateBulkProduct(data);
Params | Type | Description |
---|---|---|
data |
object |
```JSON |
{"productInstances": [{"sku": "T2BKO3966-KS","externalUrl": "http://test.t","externalId": "22825","variations": [{"sku": "newtest-1","externalId": "525827"},{"sku": "newtest-2","externalId": "525828"}]}]}
<small>https://knawat-mp.restlet.io/#operation_bulk_update_products</small>
### deleteProductBySku
_Delete Product by Product SKU from store._
```javascript
mp.deleteProductBySku(products);
https://knawat-mp.restlet.io/#operation_delete_product_by_sku
Update imported product External IDs by SKU
mp.updateProductBySku(products);
Option | Type | Required | Description |
---|---|---|---|
data |
object |
yes | Check mp documentation |
https://knawat-mp.restlet.io/#operation_update_product
Get all categories related to my products.
mp.getCategories();
https://knawat-mp.restlet.io/#operation_get_list_of_categories
mp.getOrders(limit, page);
Params | Type | Description |
---|---|---|
limit |
Number |
Number of orders to retrieve. Default: 1 |
page |
Number |
Number of the page to retrieve. Default: 1 |
mp.getOrderById(order_id);
Params | Type | Description |
---|---|---|
order_id |
string |
Knawat Order ID |
mp.createOrder(order_data);
Params | Type | Description |
---|---|---|
order_data |
object |
Array of Order Data for create order |
mp.updateOrder(order_id, order_data);
Params | Type | Description |
---|---|---|
order_id |
string |
Knawat Order ID |
order_data |
object |
Array of Updated Order Data for create order |
Params | Type | Description |
---|---|---|
endpoint |
string |
WooCommerce API endpoint, example: catalog/products or orders/{order_id} |
data |
array |
Only for POST and PUT, data that will be converted to JSON |
mp.$fetch(method, endpoint);
To disclose a security issue to our team, please submit a report here.
Developers are welcome here, please create issue or chat with us https://gitter.im/Knawat/Lobby. This repository is not suitable for Knawat customers support. Please don't use our issue tracker for support requests, but for Knawat Dropshipping NPM Package issues only. Support can take place through Knawat support portal which is available for free.
Support requests in issues on this repository will be closed on sight.
If you have a patch or have stumbled upon an issue with Knawat NPM Package, you can contribute this back to the code. Please create a pull request.