Queries
Queries are for reading data. We typically support filtering, sorting, pagination and aggregation where we return lists of data.
We will not change any entities from a query.
- Using fragments is recommended
- For more responsive queries we recommend requesting only the necessary data as we will only read the requested data from the database.
- For better performance always use variables instead of adding parameters directly in the query body
Schema
The Dimensions and Financials APIs are versatile, accommodating a variety of query types. Depending on the specific requirements of the use case, different segments of the API schema can retrieve varying degrees of data from the database.
Here are some of the most frequently utilised query categories within our API:
Lists
This is where we keep smaller versions of master record entities which are optimised for faster reads and expose a smaller amount of data
Examples of List queries include:
- Customer/Supplier Record Summaries
- Price Records
- BACS Formats
- Currency Rates
We recommend using a list wherever possible as they are less complicated than their master record
equivalents
query ($filter: CustomerSummaryFilterInput) {
debtors {
lists {
customers(filter: $filter) {
items {
primaryKey
code
name
country
currencyCode
currencySymbol
dateEdited
}
}
}
}
}
Master Records
Master records are entities which are mostly static, these are typically accounts and settings. They contain a complete set of data.
Examples of Master Records queries include:
- Customer/Supplier Records
- Stock Records
- Terms
- Analysis Records
query ($filter: NominalAccountFilterInput) {
financials {
masterRecords {
accounts {
records(filter: $filter) {
items {
details {
primaryKey
accountCode
accountName
accountType
compulsoryCosting
majorHeadingCode
compulsoryCosting
...
}
summaryData {
balance
turnoverYtd
currencyBalance
}
profile {
nominalProfile
updateFromNominalLedger
updateFromPurchaseLedger
}
}
}
}
}
}
}
Transactions
Transactions are entities which relate to master records such as invoices or remittances.
Examples of Transaction queries include:
- Nominal Summaries
- Live & Batched Transaction Data for all core ledgers
- Currency Rate history
- Notes
- Outstanding Transactions and Credit Control data
query (
$filter: SalesTransactionDetailFilterInput!
$sort: [SalesTransactionDetailSortSortByInput!]
$first: Int
) {
debtors {
transactions {
transactionEntry {
details(filter: $filter, sort: $sort, first: $first) {
items {
primaryKey
detail
analysis {
code
name
nominalUpdate {
debit {
code
name
}
credit {
code
name
}
tax {
code
name
}
}
}
tax {
code
rate
type
}
values {
net
tax
gross
currencyNet
currencyTax
currencyGross
}
costing {
project {
code
name
}
costCentre {
code
name
}
}
accrual {
accrueOverPeriods
defer
account {
code
name
}
}
}
}
}
}
}
}
Filtering
We provide complex filtering for almost every property you can select suited to the given data type. We also typically provide a summary filter which will perform a search on multiple key fields.
You can provide as many filters to as many fields you like and we will combine each filter using AND
. Please see examples for more information.
Summary
The summary
filter will perform a begins with
check on core string fields such as customer Code
and Name
. The begins with
search applies to each word within the value
of the field. For example, if the customer name is My Company
, searching by my
or company
will find the record.
Actions
Ne
- Field is not equal to filter value
Eq
- Field is equal to filter value
Le
- Field is less than or equal to filter value
Lt
- Field is less than filter value
Ge
- Field is greater than or equal to filter value
Gt
- Field is greater than filter value
Between
- Field is greater than or equal to the first filter value and less than or equal to the last filter value
NotBetween
- Field is less than the first value or greater than the second value
ContainsValues
- Field is equal to a value within the list of filter values
NotContainsValues
- Field is not equal to any value within the list of filter values
IsBlank
- When filter value is true, field is null (or blank for a string)
IsNotBlank
- When filter value is true, field is not null (and not blank for a string)
BeginsWith
- String field begins with filter value
DoesNotBeginWith
- String field does not begin with filter value
EndsWith
- String field ends with filter value
DoesNotEndWith
- String field does not end with filter value
Contains
- Filter value matches part of the string field
DoesNotContain
- Filter value matches no part of the string field
DayX
- Day number x in any month in any year
NotDayX
- All dates except where the day is x
LastXDays
- Today and up to x days prior
NextXDays
- Today and up to x days hence
TodayInAnyYear
- Todays day and month in any year
Today
- Today
NotToday
- Everything but today
Yesterday
- Yesterday
NotYesterday
- Everything but yesterday
Tomorrow
- Tomorrow
NotTomorrow
- Everything but tomorrow
MonthX
- Month number x in any year
NotMonthX
- All dates except where the month number is x
LastXMonths
- Today and up to x months prior
NextXMonths
- Today and up to x months hence
ThisCalendarMonthInAnyYear
- This month in any year
ThisCalendarMonth
- This month, in this year
NotThisCalendarMonth
- Any date except one within this month in this year
LastCalendarMonth
- Last month, in this year
NotLastCalendarMonth
- Any date except one within last month in its year
NextCalendarMonth
- Next month, in its year
NotNextCalendarMonth
- Any date except one within next month in its year
YearX
- Year x
NotYearX
- All dates except where the year is x
LastXYears
- Today and up to x years prior
NextXYears
- Today and up to x years hence
ThisCalendarYear
- This year
NotThisCalendarYear
- Any date except one within this year
LastCalendarYear
- Last year
NotLastCalendarYear
- Any date except one within last year
NextCalendarYear
- Next year
NotNextCalendarYear
- Any date except one within next year
Types
String | Numeric | Date | Enum/Boolean/Guid | |
---|---|---|---|---|
Ne | ✅ | ✅ | ✅ | ✅ |
Eq | ✅ | ✅ | ✅ | ✅ |
Le | ✅ | ✅ | ✅ | |
Lt | ✅ | ✅ | ✅ | |
Ge | ✅ | ✅ | ✅ | |
Gt | ✅ | ✅ | ✅ | |
Between | ✅ | ✅ | ✅ | |
NotBetween | ✅ | ✅ | ✅ | |
ContainsValues | ✅ | ✅ | ✅ | ✅ |
NotContainsValues | ✅ | ✅ | ✅ |