Raw Data Queries
Reading Sales Data
You will require an access token with the Raw Data (View) permission to access these endpoints.
Query Sales Endpoint
This endpoint is for requesting the raw individual transactions for a given filter. Given the expansive nature of the SalesTransaction model default queries will only request the top level SalesTransaction object, all child objects (such as) Payments, Items etc will not be returned unless the query specifically requests them.
The top level SalesTransactionQuery is where you can specify all inclusions (omission will default to not include) and pagination information. The maximum page size is bound by MAX_LIMIT
The top level SalesTransactionFilter is where the query can be constrained to a subset of the data (perhaps based on date ranges or sales transaction contents).
Depending on the size of the sales database and the complexity of filters you can typically expect responses within 0.5 and 30 seconds so this endpoint is not recommended for use with real time data analysis.
Request
POST: api/v1/salestransactions/query
For the body JSON Encode a SalesQueryRequest with Query being of type SalesTransactionQuery and Filter being of type SalesTransactionFilter
Example SalesQueryRequest Will request the first 10 (non training) transactions that have adjustments for a given period of time. Payments will be included.
{
"query": {
"salesTransactionPayments": {
"include": true
},
"limit": 10,
"from": 0
},
"filter": {
"isTraining": false,
"containsItemAdjustmentLinks": true,
"tradingDateTimeClosed": {
"range": {
"from": "2020-01-25T19:20:30.45Z",
"to": "2020-01-25T20:00:00.45Z"
}
}
}
}
Response
Expected JSON Response will be an array of SalesTransaction objects. The SalesTransaction objects will only have their "child" lists of entities populated if the query explicitly requested their inclusion.
Query Non Sale Activities
This endpoint is for requesting the raw non sale activities for a given filter.
The top level NonSaleActivityQuery allows you to specify pagination/ordering. The maximum page size is bound by MAX_LIMIT.
The top level NonSaleActivityFilter is where the query can be constrained to a subset of the data (perhaps based on date or value ranges).
Depending on the size of the sales database and the complexity of filters you can typically expect responses within 0.5 and 5 seconds so this endpoint is not recommended for use with real time data analysis.
Request
POST: api/v1/nonsaleactivities/query
For the body JSON Encode a SalesQueryRequest with Query being of type NonSaleActivityQuery and Filter being of type NonSaleActivityFilter
Example SalesQueryRequest Will request the first 10 (non training) non sale activities that are positive for a given period of time. Results will be ordered by highest Amounts first.
{
"query": {
"orderBy": [4], /* Amount */
"orderByDirection": 0, /* Descending */
"limit": 10,
"from": 0
},
"filter": {
"isTraining": false,
"tradingDateTime": {
"range": {
"from": "2020-01-25T19:20:30.45Z",
"to": "2020-01-25T20:00:00.45Z"
}
},
"amount": {
"range": {
"from": 0
}
}
}
}
Response
Expected JSON Response will be an array of NonSaleActivity objects.
Query ZReports
This endpoint is for requesting the raw individual ZReports for a given filter. Given the expansive nature of the ZReport model default queries will only request the top level ZReport object, all child objects (such as) audit lines, interface items etc will not be returned unless the query specifically requests them.
The top level ZReportQuery is where you can specify all inclusions (omission will default to not include) and pagination information. The maximum page size is bound by MAX_LIMIT
The top level ZReportFilter is where the query can be constrained to a subset of the data (perhaps based on date ranges or zreport contents).
Depending on the size of the sales database and the complexity of filters you can typically expect responses within 0.5 and 30 seconds so this endpoint is not recommended for use with real time data analysis.
Request
POST: api/v1/zreports/query
For the body JSON Encode a SalesQueryRequest with Query being of type ZReportQuery and Filter being of type ZReportFilter
Example SalesQueryRequest Will request the first 10 (non training) ZReports for a given period of time. interface items will be included.
{
"query": {
"zReportInterfaceItems": {
"include": true
},
"limit": 10,
"from": 0
},
"filter": {
"isTraining": false,
"tradingDate": {
"range": {
"from": "2020-01-25T19:20:30.45Z",
"to": "2020-01-25T20:00:00.45Z"
}
}
}
}
Response
Expected JSON Response will be an array of ZReport objects. The ZReport objects will only have their "child" lists of entities populated if the query explicitly requested their inclusion.