This is a staging build of the docs
Skip to main content

Orders

Reference document for the endpoint that produces orders data

The Orders endpoint retrieves the number of orders, total value and average order value for a specific company's commerce connection, over one or more periods of time.

Refer to the Lending reporting structure page for more detail on reports in Lending.

For Orders, these are the dimensions and measures:

Dimensions

  • Period
  • Order metrics

Measures

  • Count
  • Value

Report Data

  • Is structured based on dimension (index =“0”), i.e. Period.
  • The endpoint will return the number of orders, total value and average order value for each period.

View the Orders formulas.

The endpoint is available in our API reference.

GET /data/companies/{companyId}/connections/{connectionId}/lending/commerceMetrics/orders

Parameters

ParameterTypeDescriptionRequired
reportDatestring
See Date
YYYY-MM-DD
Datetime or Date (inclusive of the whole day).
Required
periodUnitstringThe period unit of time returned, and it can be: “Day”, “Week”, “Month”, “Year”.Required
periodLengthintegerBased on the period unit provided.
It must be positive, not zero and an integer.
Required
numberOfPeriodsintegerThe number of periods to return.
It must be positive, not zero and an integer.
Required
includeDisplayNamesbooleanShows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.
Default is false.
Optional

Data model

The response structure is split into four areas: Report info, Dimensions, Measures and Report data.

Report info

FieldTypeDescription
namestring"orders"
displayNamestring"Orders"

Dimensions

Orders consists of these dimensions: Period and Order metrics.

Dimension (index = “0”): Period

FieldTypeDescription
displayNamestringPeriod
typestringdatespan
itemsarray
See Dimension (index = “0”) items.
Returns an array of “Period”.
This is driven by the query parameter

Dimension (index = “0”) items

FieldTypeDescription
displayNamestring"Period n"
startstring See DateYYYY-MM-DD, date in which the period begins (inclusive).
endstring See DateYYYY-MM-DD, date in which the period ends (inclusive).

Dimension (index = “1”): Order metrics

FieldTypeDescription
displayNamestring"Order metrics"
typestring"string"
itemsarray
See Dimension (index = “1”) items
Returns an array of order metrics.

Dimension (index = “1”) items

FieldTypeDescription
valuestring“Number of orders”, “Total value” or "Average order value".
These will always show for any response in this report. The dimension values are not dependent on the user’s query parameters.

Measures

Measures provide information about the measures contained in the report data.

The two measures for this report are as follows:

Index “0” - Count

FieldTypeDescription
displayNamestring"Count"
typenumber"int"

Index “1” - Value

FieldTypeDescription
displayNamestring“value”
unitsstringThe base currency of the company’s commerce connection.
typestring“currency”

Report data

The report data combines multiple reporting dimensions and outputs the value of each combination. Each dimension reference is specified.

Since the report data is reflective of two dimensions and their measures, the tables below represent each component grouping.

Each object is grouped by dimension (index=“0”) which is the number of periods specified by the user in the query parameters.

Each period will be broken down into Order metrics.

Components structure

FieldTypeDescription
dimensionnumberIndex 1
dimensionDisplayNamestringShows when includeDisplayNames is set to true.
itemnumber
itemDisplayNamestringShows when includeDisplayNames is set to true.
measuresSee Measures in components

All components have the structure described in the Measures in components data model below.

Measures in components

Index "0" - Count

FieldTypeDescription
measureDisplayNamestring"Count"
valuenumber

Index “1” - Value

FieldTypeDescription
measureDisplayNamestring"value"
valuenumber

Example data

{
"reportInfo": {
"name": "orders",
"displayName": "Orders"
},
"dimensions": [
{
"index": 0,
"displayName": "Period",
"type": "datespan",
"items": [
{
"index": 0,
"displayName": "Period 0",
"start": "2021-03-30",
"end": "2021-04-30"
},
{
"index": 1,
"displayName": "Period 1",
"start": "2021-04-30",
"end": "2021-05-31"
}
]
},
{
"index": 1,
"displayName": "Order metrics",
"type": "string",
"items": [
{
"index": 0,
"value": "Number of orders"
},
{
"index": 1,
"value": "Total value"
},
{
"index": 2,
"value": "Average order value"
}
]
}
],
"measures": [
{
"displayName": "Count",
"index": 0,
"type": "int"
},
{
"displayName": "Value",
"units": "GBP",
"index": 1,
"type": "currency"
}
],
"reportData": [
{
"dimension": 0,
"dimensionDisplayName": "Period",
"item": 0,
"itemDisplayName": "Period 0",
"components": [
{
"dimension": 1,
"dimensionDisplayName": "Order metrics",
"item": 0,
"itemDisplayName": "Number of orders",
"measures": [
{
"index": 0,
"measureDisplayName": "Count",
"value": 8
}
]
},
{
"dimension": 1,
"dimensionDisplayName": "Order metrics",
"item": 1,
"itemDisplayName": "Total value",
"measures": [
{
"index": 1,
"measureDisplayName": "Value",
"value": 341.98
}
]
},
{
"dimension": 1,
"dimensionDisplayName": "Order metrics",
"item": 2,
"itemDisplayName": "Average order value",
"measures": [
{
"index": 1,
"measureDisplayName": "Value",
"value": 42.75
}
]
}
]
},
{
"dimension": 0,
"dimensionDisplayName": "Period",
"item": 1,
"itemDisplayName": "Period 1",
"components": [
{
"dimension": 1,
"dimensionDisplayName": "Order metrics",
"item": 0,
"itemDisplayName": "Number of orders",
"measures": [
{
"index": 0,
"measureDisplayName": "Count",
"value": 10
}
]
},
{
"dimension": 1,
"dimensionDisplayName": "Order metrics",
"item": 1,
"itemDisplayName": "Total value",
"measures": [
{
"index": 1,
"measureDisplayName": "Value",
"value": 526.23
}
]
},
{
"dimension": 1,
"dimensionDisplayName": "Order metrics",
"item": 2,
"itemDisplayName": "Average order value",
"measures": [
{
"index": 1,
"measureDisplayName": "Value",
"value": 52.62
}
]
}
]
}
]
}

Was this page useful?
❤️
👍
🤔
👎
😭