npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@knawat/mp

v1.7.6

Published

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

Downloads

184

Readme

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

| 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 | | apiRateLimit | object | optional | Overwrite the API rate limit (not recommended) | | SET_ASYNC | string | optional | Overwrite 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.

| Params | Type | Description | | --------- | -------- | ---------------------------------------------------------------------------- | | Method | string | HTTP Methods for RESTful Services (Get, Put, Post, Patch, Delete) | | Path | string | WooCommerce API endpoint, example: catalog/products or orders/{order_id} | | options | Object | options { 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