knawat/knawat-php-sdk

A PHP wrapper for the Knawat REST API

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.0.2 2021-02-05 10:09 UTC

This package is auto-updated.

Last update: 2024-01-12 16:16:54 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, $args);
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
args array Optional. More params that you want to pass to API. More info

getProductBySku (GET Product By SKU)

$mp->getProductBySku($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