Report GET

Get report objects, which aggregates basket, transaction, and product data for all completed baskets.

This API GET call allows you to retrieve your report object with full detail using a custom SWQL (Shopwave Query Language) query, which allows customisation of SELECT, FROM, WHERE, and GROUP parameters.

The endpoint you need to use for this is:

/report

Request

Headers

Key Details Example
Authorization* {token_type} {access_token} Bearer c3499c2729730a7f807efb8676a92dcb6f8a3f8f
Method* GET N/A
x-accept-version {recommended_latest_version_number} 2
query* Your SWQL query, which will custom fetch data. { "0": { "FROM": "Basket", "WHERE": { "AND": [ "Basket.completeDate > '2017-01-21 00:00:00'", "Basket.completeDate < '2017-01-21 23:00:00'"] } } }

* Required header

SWQL Query

Shopwave stores merchant / consumer data in a variety of different places, using a wide range of technologies. SWQL (Shopwave Query Language) is a simple way to work with all of these data stores with one query language.

Using the merchant Basket object as an example; data is stored across 3 independant services, in a variety of structures and formats. As you choose how to SELECT the data, the API will pull data from different sources into the structure you ask for.

Parameter Details Example
SELECT Allows the result set to be formatted as needed. "Basket.name AS name, Basket.completeDate AS date"
FROM* Specifies which dataset is used for the report. "Basket"
WHERE* Flexible conditions filtering the result set. { "AND": [ "Basket.completeDate > '2017-01-21 00:00:00'", "Basket.completeDate < '2017-01-21 23:00:00'"] }
GROUP Allows for the result to be grouped by a column. "Basket.id"

* Required parameter

Response

The response is divided into 2 parts: keys and data.

The data part is standard JSON, using only arrays (no objects), which allows the API to cut the response content length by over 60%. So, for a response that might be 10mb with objects and keys, it will only be roughly 3.8mb using just arrays.

The keys part is also standard JSON and shows how the arrays are built within the data element. So, for example, if your first key is {"name": "Basket.id","type": "int"}, then for each response element in data, the first array index will contain the "Basket.id" with the data type as "int". As you customise your SWQL SELECT, these keys are likely to change.

For a reporting API, which on average returns between 10,000 and 100,000 response elements, this data size saving is essential.

Headers

Key Details Data Type Example
statusCode Very important to check this for shopwave server uptime. 200 for success. int 200

Body

Key Details Data Type
keys Gives you a breakdown for how your data is formed in the data param. array
data Your data which is returned based on your SWQL query. array

Example response

Headers

Key Value
statusCode 200

Body


                                                

Attribute Options

Transaction Type Id

ID Value
0 CASH
1 CARD
2 CHEQUE
3 VOUCHER
4 APP

Status Codes

Error

Please check the live API calls for more details on the API messages.

ID Status Code Title Details
908 401 Expired Token Token expired or invalid. Please renew your token
911 401 Authorization Header Invalid The authorization header is invalid. The correct format is Authorization: {token_type} {accessToken}
912 403 Resource Not Allowed For Specified User The user does not own this resource and its forbidden
899 500 Unknown Error Something went wrong. Please contact the site administrator
917 500 Internal Server Error Something went wrong.

Success

Please check the live API calls for more details on the API messages.

ID Status Code Title Details
203 200 Request Processed Successfully The request has been successfully completed.
204 204 No content to return End of the page or no content to return for your request
202 200 Token is valid Token is validated and found valid.
preloader