🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@knawat/mp

Package Overview
Dependencies
Maintainers
3
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@knawat/mp

A Node.js package for the Knawat Dropshipping MP REST API

1.7.6
latest
Source
npm
Version published
Weekly downloads
47
-64.66%
Maintainers
3
Weekly downloads
 
Created
Source

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 Merchants REST API. Easily interact with the Knawat MP REST API using this library.

Installation

npm install @knawat/mp --save

yarn add @knawat/mp

Getting started

Check out the Knawat Dropshipping MP REST API endpoints and data that can be manipulated in our documentations.

Setup

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',
});

// Provide instance with a generated access_token
const mp = new MP({
  access_token: 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
});

// Or use your store id/URL
// Supported using basic auth only
const mp = new MP({
  store: 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
});

Options

OptionTypeRequiredDescription
keystringconditionalYour Store's API consumer key if token not provided this field is required
secretstringconditionalYour Store's API consumer secret if token not provided this field is required
storestringconditionalYour store current store URL
apiRateLimitobjectoptionalOverwrite the API rate limit (not recommended)
SET_ASYNCstringoptionalOverwrite the async setting for api call

Getting Access tokens

Library Methods

Products Functions

All the functions mentioned here return a promise and it's an async function.

What's mentioned between [brackets] are the authentication method used for the functions.

Example

mp.getProducts() // return a promise.

Note: the methods with the Dev tag is still underdevelopment.

REST Function

This function is used internally as a wrapper for the library. An Async function that requests Data from server.

ParamsTypeDescription
MethodstringHTTP Methods for RESTful Services (Get, Put, Post, Patch, Delete)
PathstringWooCommerce API endpoint, example: catalog/products or orders/{order_id}
optionsObjectoptions { SET_ASYNC, queryParams, auth, body, headers }
mp.$fetch(method, path, (options = {}));

Example:

mp.$fetch('GET', '/catalog/categories', { auth: 'token' }); // returns object : count and categories array

postman and bearer token.

If you want to test the API on the postman you can get the bearer token by using this following methods:

mp.getTokenAuth(); // Async function
mp.getTokenAuth().then(console.log);

After that you can use the available methods to test and see the results you got!.

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

Keywords

dropshipping

FAQs

Package last updated on 23 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts