Skip to content
Sign in

Reporting API

This content is for 5.0 (Preview). Switch to 4.5 (Current) for the current release documentation.

Access to the reporting API is handle by cube.js which allows for optimal performance, pre-aggregation and access control. Request can be done through a REST API or any of the provided client libraries such as React, Vue or Web sockets. See [https://cube.dev/docs/frontend-introduction] for more details on available integration libraries.

https://reporting.qpos.me/cubejs-api/v1

Start by obtaining an access token. The access token must be included in the header for all requests. See the previous chapter for more information.

A request can also include a query param that is interpreted by the API, translated to SQL and which returns a response with the relevant json data.

A simple request to count all orders

Terminal window
curl --request GET 'https://reporting.qpos.me/cubejs-api/v1/load?query={"measures":["orders.count"]}' \
--header 'Authorization: Bearer eyJhbGciOi...'\
{
"data": [
{
"orders.count": 19461
}
],
"query": {
...
}
}

Retrieve a list of all cubes, dimensions and measures

Terminal window
https://reporting.qpos.me/cubejs-api/v1/meta

By default QUEUE API will queries and results will be UTC timezone, but a timezone parameter can be provided:

Terminal window
curl --request GET 'https://reporting.qpos.me/cubejs-api/v1/load?query={"timezone": "Europe/Berlin", "measures":["orders.count"]}' \
--header 'Authorization: Bearer eyJhbGciOi...'\

to use a specific timezone.

Terminal window
curl --request GET 'https://reporting.qpos.me/cubejs-api/v1/load?query={"dimensions": ["orders.paid_at", "orders.status", "orders.amount"], "limit": 2, "order": [["orders.paid_at", "desc"]]}' \
--header 'Authorization: Bearer eyJhbGciOiJSUz...' \
--header 'Content-Type: application/x-www-form-urlencoded'
{
"data": [
{
"orders.paid_at": "2023-10-18T02:37:01.234",
"orders.status": "paid",
"orders.amount": 150
},
{
"orders.paid_at": "2023-09-01T04:46:30.896",
"orders.status": "paid",
"orders.amount": 180
}
],
"query": {
...
},
}

Get list of line items with order and quantity in date range

Section titled “Get list of line items with order and quantity in date range”
Terminal window
curl --request GET 'https://reporting.qpos.me/cubejs-api/v1/load?query={"dimensions": ["orders.id", "orders.paid_at", "orders.status", "orders.amount","menu_products.name", "menu_variants.name", "line_items.quantity"], "filters": [{"member": "orders.paid_at", "operator": "inDateRange", "values": ["2023-10-01", "2023-11-01"] }], "order": [["orders.paid_at", "asc"]], "limit": 3}' \
--header 'Authorization: Bearer eyJhbGciOi...'
{
"data": [
{
"orders.id": "4WGOlrQUA9Tq8-HA6cGBtC",
"orders.paid_at": "2023-10-18T02:37:01.234",
"orders.status": "paid",
"orders.amount": 150,
"menu_products.name": "Coffee",
"menu_variants.name": "Large",
"line_items.quantity": 1
}
],
"query": {
...
}
}