zalasid / Knawat-NPM-JavaScript-SDK

NPM Package handling https://mp.knawat.io endpoints

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Knawat

Join the chat at Knawat Average time to resolve an issue Percentage of issues still open npm npm

Knawat Node.js NPM Package (MP)

Codacy Badge

A Node.js package for Knawat Dropshipping MP REST API. Easily interact with the Knawat MP REST API using this library.

Installation

npm install --save @knawat/mp

Getting started

Check out the Knawat Dropshipping MP REST API endpoints and data that can be manipulated in https://mp.knawat.io/.

Setup

Setup for the new Knawat Dropshipping REST API integration:

const MP = require('knawat/mp');

const mp = new MP({
  key: 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
  secret: 'XXXXXXXXXXXXXXXXXXXXXXXX',
  token: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
});

Options

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
token string conditional Previous token if key and secret not provided this field is required

https://knawat-mp.restlet.io/#operation_get_token

Methods

Product Methods

getProducts

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

addProducts

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

getProductsCount

Get in stock products count

mp.getProductsCount();

https://knawat-mp.restlet.io/#operation_products_count

getProductBySku

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

updateBulkProduct

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

updateProductBySku

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

getCategories

Get all categories related to my products.

mp.getCategories();

https://knawat-mp.restlet.io/#operation_get_list_of_categories

Order Methods

getOrders (GET Orders)

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

getOrderById (GET Order By Knawat Order Id)

mp.getOrderById(order_id);
Params Type Description
order_id string Knawat Order ID

createOrder (Create Order)

mp.createOrder(order_data);
Params Type Description
order_data object Array of Order Data for create order

updateOrder (Update 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

REST Methods

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

Request

mp.$fetch(method, endpoint);

Reporting Security Issues

To disclose a security issue to our team, please submit a report here.

Support & Chat

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.

Contributing to Knawat

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.

Check also

About

NPM Package handling https://mp.knawat.io endpoints

License:MIT License


Languages

Language:JavaScript 99.6%Language:Shell 0.4%