cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member

PURPOSE

WooCommerce provides a REST API for many different operations within their platform.  This API provides endpoints with data that can be pulled into the elasticube in order to analyze store performance.  (Sales, products, coupons, etc)  This post describes how to use Sisense's REST API Framework to authenticate & download data from WooCommerce.

REQUIREMENTS & API SETUP

 This is a required part of Sisense's REST API framework which facilitates reading the data properly.
The Connector can use basic authentication using the consumer key as username and the consumer secret as the password.
 

INSTALLING THE CONNECTOR

  1. Download the connector here.
  2. Unzip the file.
  3. Copy the unzipped folder (named REST.WooCommerce.Connector, which should contain a config.json file and a Sisense.Connectors.RestConnector.dll file) to the your Sisense directory, located at the directory listed below.
  4. Inside the resulting folder, open config.json with any text editor (eg. Notepad++).  In the first section under settings.Parameters, edit the Base, Consumer Key & Consumer Secret parameters.
...\Program Files\Sisense\DataConnectors\DotNetContainer\Connectors
 

TABLES

The WooCommerce API has several endpoints for pulling different data.  See Reports API Documentation for reference.
In this connector, two tables:  Products and orders.  Have added some hardcoded date filters and status filters that can be fine tuned based on your needs and using our in memory parameters.
 

MODIFYING THE CONNECTOR

There are a few sections of the config.json file that can be modified to suit your needs.  First, are the credentials, found under settings.parameters.  You should only change the settings for Base, Consumer_key & Consumer_Secret.
{
  "Settings": {
    "Provider": "REST.WooCommerce.Connector",
    "DisplayName": "WooCommerce",
    "MaxDocs": 15,
"TodayFormat":"yyy-MM-dd",
    "Parameters": {
"Base": "https://XXXXXXXXXXXXXXX.com/wp-json/wc/v1",
"consumer_key":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"consumer_secret":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }
},
Second, the tables section can be modified to include other fields / reports or change the filters or granularity for the existing reports.

ADDITIONAL NOTES

Modification of this connector is intended for those with experience with web development & REST APIs.  Detail & care must be given when pulling from new endpoints or modifying any of these tables.
Rate this article:
Version history
Last update:
‎03-02-2023 08:52 AM
Updated by:
Contributors