WooCommerce Rest API Connector
Summary: intapiuser provides a detailed guide on using Sisense's REST API Framework to authenticate and download data from WooCommerce for store performance analysis. The process involves installing the Sisense MongoDB ODBC Driver, configuring a connector with the consumer key and secret, and modifying the config.json file for customization. Tips are included for those experienced with web development and REST APIs, with recommendations for handling data endpoints and filters.
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
Install the Sisense MongoDB ODBC Driver.
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
Download the connector here.
Unzip the file.
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.
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.