Sell&Sell REST API Client Library

About

A PHP wrapper for the Sell&Sell REST API. Easily interact with the Sell&Sell REST API using this wrapper class.

Requirements

PHP 5.2.x cURL

Getting started

Generate API credentials ( Consumer Key & Consumer Secret ) on your profile page for the store you want to interact with.

A good place to start is to look at the example script included in the API Files.

Initialize the class

<?php
    require_once 'class-ss-api-client.php';

    $consumer_key = 'YOUR_CONSUMER_KEY'; // Add your own Consumer Key here
    $consumer_secret = 'YOUR_CONSUMER_SECRET'; // Add your own Consumer Secret here
    $store_url = 'http://STORE_URL/'; // Add the home URL to the store you want to connect to here

    // Initialize the class
    $ss_api = new SS_API_Client( $consumer_key, $consumer_secret, $store_url );
?>

Get the data using methods

<?php
    // Get all orders
    $orders = $ss_api->get_orders();
    print_r( $orders );
?>

All methods return the data json_decode() by default so you can access the data.

Available methods

Index method

  • get_index()

Order methods

  • get_orders()
  • get_orders( $params = array( 'status' => 'completed' ) )
  • get_order( $order_id )
  • get_orders_count()
  • get_order_notes( $order_id )
  • update_order( $order_id, $data = array( 'status' => 'processing' ) )
  • update_order( $order_id, $data = array( 'status' => 'processing', 'note' => 'This is a note') )

Coupon methods

  • get_coupons()
  • get_coupon( $coupon_id )
  • get_coupon_by_code( $coupon_code )
  • get_coupons_count()

Customer methods

  • get_customers()
  • get_customers( $params = array( 'filter[created_at_min]' => '2013-12-01' ) )
  • get_customer( $customer_id )
  • get_customers_count()
  • get_customer_orders( $customer_id )

Product methods

  • get_products()
  • get_products( $params = array( 'filter[created_at_min]' => '2013-12-01' ) )
  • get_product( $product_id )
  • get_products_count()
  • get_product_reviews( $product_id )

Report methods

  • get_reports()
  • get_sales_report( $params = array( 'filter[start_date]' => '2013-12-01', 'filter[end_date]' => '2013-12-09' ) )
  • get_top_sellers_report( $params = array( 'filter[limit]' = '10' ) )

Custom endpoints

If you extended the Sell&Sell API with your own endpoints you can use the following function to get access to that data

  • make_custom_endpoint_call( $endpoint, $params = array(), $method = 'GET' )