knawat/knawat-php-sdk

A PHP wrapper for the Knawat REST API

1.0.1 2018-12-11 13:09 UTC

README

Knawat

Join the chat at https://gitter.im/Knawat/Lobby

Knawat-PHP-SDK

A PHP wrapper for the Knawat Dropshipping REST API. Easily interact with the Knawat Dropshipping REST API using this library.

Installation

composer require knawat/knawat-php-sdk

Getting started

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

Setup

Setup for the new Knawat Dropshipping REST API integration:

require __DIR__ . '/vendor/autoload.php';

use Knawat\MP;

$mp = new MP(
    'consumer_key_XXXXXXXXXXXXXXXXXXXXXXXXXXX',
    'consumer_secret_XXXXXXXXXXXXXXXXXXXXXXXX'
);

Options

Option Type Required Description
consumer_key string yes Your Store's API consumer key
consumer_secret string yes Your Store's API consumer secret

Methods

Product Methods

getProducts (GET Products)

$mp->getProducts($limit, $page, $lastupdate);
Params Type Description
limit Integer Number of products to retrieve. Default: 25
page Integer Number of the page to retrieve. Default: 1
lastupdate TimeStamp Optional. UTC Timestamp of last import. for get only updated products after this Timestamp

getProductBySku (GET Product By SKU)

$mp->getProducts($sku);
Params Type Description
sku string SKU of Product you want to get

Order Methods

getOrders (GET Orders)

$mp->getOrders($limit, $page);
Params Type Description
limit Integer Number of orders to retrieve. Default: 10
page Integer 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 array 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 array 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

GET

$mp->get($endpoint)

POST

$mp->post($endpoint, $data)

PUT

$mp->put($endpoint, $data)

DELETE

$mp->delete($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 PHP SDK 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 PHP SDK, you can contribute this back to the code. Please create a pull request.

Check also