Skip to content

Latest commit

 

History

History
254 lines (215 loc) · 7.34 KB

GOINSIGHT_API.md

File metadata and controls

254 lines (215 loc) · 7.34 KB

GoInsight APIs

GoInsight APIs allow third party system search app bizData form goInsight.

Constructors of GoInsightApi

public GoInsightApi(string baseUrl, string apiKey, string apiSecret, TimeZoneInfo timeZoneInfo = null, int timeout = 5000, IWebProxy proxy = null)
public GoInsightApi(string baseUrl, string apiKey, string apiSecret, TimeZoneInfo timeZoneInfo)
public GoInsightApi(string baseUrl, string apiKey, string apiSecret, IWebProxy proxy)
public GoInsightApi(string baseUrl, string apiKey, string apiSecret, int timeout)

Constructor parameters description

Name Type Description
baseUrl string the base url of REST API
apiKey string the apiKey of marketplace, get this key from PAXSTORE admin/reseller console, refer to chapter Apply access rights
apiSecret string apiSecret, get api secret from PAXSTORE admin/reseller console, refer to chapter Apply access rights
timeZoneInfo TimeZoneInfo the timeZone, the default timeZone is TimeZoneInfo.Local, the biz data in return object depend on timeZone

Search APP BizData

The search app bizData API allow the third party system search data.
Note: This result of this API depends on the API query settings in GoInsight. Paging needs to be set when the query result set type is a details data.

API

public Result<DataQueryResult> FindDataFromInsight(string queryCode)

public Result<DataQueryResult> FindDataFromInsight(string queryCode, TimeRange timeRange)
   
public Result<DataQueryResult> FindDataFromInsight(string queryCode, TimeRange timeRange, Nullable<int> pageNo, Nullable<int> pageSize)  

Input parameter(s) description

Name Type Nullable Description
queryCode string false search by GoInsight api query code
rangeType TimeRange true you can choose the range of data results for search
pageNo Nullable<int> true page number, value must >= 1
pageSize Nullable<int> true the record number per page, range is 1 to 100 for details data query, range is 1 to 1000 for statistics data query

Note: The pageNo param will be ignore when your query result set type is statistics chart.

Value of enum TimeRange

Value Description
LAST_HOUR Last Hour
YESTERDAY Yesterday
LAST_WEEK Last Week
LAST_MONTH Last Month
LAST_QUARTER Last Quarter
LAST_YEAR Last Year
LAST_YEAR_BY_QUARTER Last Year (by quarter)
RECENT_5_MIN Recent 5 Minute: Past 5m
RECENT_30_MIN Recent 30 Minute: Past 30m
RECENT_HOUR Recent Hour: Past 1h
RECENT_3_HOUR Recent 3 Hour: Past 3h
RECENT_DAY Recent Day
RECENT_2_DAY Recent 2 Day: Past 48h
RECENT_5_DAY Recent 5 Day: Past 120h
RECENT_WEEK Recent Week
RECENT_MONTH Recent Month
RECENT_3_MONTH Recent 3 Month
RECENT_6_MONTH Recent 6 Month
RECENT_YEAR Recent Year
RECENT_YEAR_BY_QUARTER Recent Year (by quarter)
THIS_HOUR This Hour
TODAY Today
THIS_WEEK This Week
THIS_MONTH This Month
THIS_QUARTER This Quarter
THIS_QUARTER_BY_WEEK This Quarter (by week)
THIS_YEAR This Year
THIS_YEAR_BY_QUARTER This Year (by quarter)

Sample codes

GoInsightApi goInsightApi = new GoInsightApi("https://api.whatspos.com/p-market-api", "RCA9MDH6YN3WSSGPW6TJ", "TUNLDZVZECHNKZ4FW07XFCKN2W0N8ZDEA5ENKZYN", TimeZoneInfo.FindSystemTimeZoneById("China Standard Time"));
Result<DataQueryResult> resultData = goInsightApi.FindDataFromInsight("ahh3y62t");

Client side validation failed sample result(JSON formatted)

{
	"BusinessCode": 36000,
	"ValidationErrors": ["The query code is not found"]
}

Succssful sample result(JSON formatted)

{
	"BusinessCode": 0,
	"Data": {
        "WorksheetName": "Merchant transaction amount trend (This Year)",
		"Columns": [{
			"ColName": "acquirer_type",
			"DisplayName": "Acquirer Type",
            "Type": "Dimension"
		}, {
			"ColName": "currency",
			"DisplayName": "Currency",
            "Type": "Dimension"
		}, {
			"ColName": "purchase_id",
			"DisplayName": "Purchase ID",
            "Type": "Dimension"
		}, {
			"ColName": "amount",
			"DisplayName": "Amount",
            "Type": "Measure"
		}, {
			"ColName": "tax",
			"DisplayName": "Tax",
            "Type": "Measure"
		}, {
			"ColName": "_sys_marketid",
			"DisplayName": "Marketplace",
            "Type": "Dimension"
		}, {
			"ColName": "_sys_merchantid",
			"DisplayName": "Merchant",
            "Type": "Dimension"
		}, {
			"ColName": "_sys_terminalid",
			"DisplayName": "Terminal",
            "Type": "Dimension"
		}],
		"Rows": [
			[{
				"ColName": "acquirer_type",
				"Value": "ZTO"
			}, {
				"ColName": "currency",
				"Value": "USD"
			}, {
                "ColName": "purchase_id",
				"Value": "15851195134847"
			}, {
                "ColName": "amount",
				"Value": "169.15"
			}, {
                "ColName": "tax",
				"Value": "64.38"
			}, {
				"ColName": "_sys_marketid",
				"Value": "demo"
			}, {
				"ColName": "_sys_merchantid",
				"Value": "Macy’s"
			}, {
				"ColName": "_sys_terminalid",
				"Value": "0820087295"
			}],
            [{
				"ColName": "acquirer_type",
				"Value": "ZTO"
			}, {
				"ColName": "currency",
				"Value": "USD"
			}, {
                "ColName": "purchase_id",
				"Value": "15851135975100"
			}, {
                "ColName": "amount",
				"Value": "2990.09"
			}, {
                "ColName": "tax",
				"Value": "64.12"
			}, {
				"ColName": "_sys_marketid",
				"Value": "demo"
			}, {
				"ColName": "_sys_merchantid",
				"Value": "Macy’s"
			}, {
				"ColName": "_sys_terminalid",
				"Value": "0820087295"
			}]
		],
        "Offset": 10,
		"Limit": 10,
		"HasNext": true,
	},
	"RateLimitRemain": ""
}

The type in dataSet of result is DataQueryResult. The structure shows below.

Structure of class DataQueryResult

Property Name Type Description
WorksheetName string The result set worksheet name.
Columns List<Column> The result set column
Rows List<List<Row>> The result set
HasNext Nullable<bool> Is there any data.
Offset Nullable<long> Rows offset if exit page info.
Limit Nullable<int> Rows page size if exit page info.

Structure of class Column

Property Name Type Description
ColName string The dataset filed name in GoInsight
DisplayName string The dataset filed's display name
Type string Data analysis type of dataset field. Value can be one of Dimension, Measure and Image

Structure of class Row

Property Name Type Description
ColName string The dataset filed name in GoInsight
Value string The dataset filed's value

Possible client validation errors

Parameter queryCode is mandatory!
The length of parameter queryCode must 8! Parameter pageSize must be range is 1 to 1000

Possible business codes

Business Code Message Description
36000 The query code is not found  
36001 The query code is not active  
36002 Query failed, please try again  
36003 The query is timeout, please try again  
36004 Insufficient permissions  
36005 Invalid pageNo  
36006 Invalid pageSize  
36008 Query failed, please contact administrator  
36009 Too many request, please try again later  

Possible abnormal http codes

Http Code Message Description
429 Too many request, please try again in one minute, two minutes or whatever