Samples of queries
Quick Links
Accounts Accounting Entries Products Customers Sales quotes Sales invoices Suppliers Purchase invoicesDon’t forget,
You can find all the examples below by downloading, then importing into Postman, the collection :
Quick start / 5. Test your first query in Postman
JournalTypes type in
PURCHASE,SALES
query {
journalTypes (
where: {
type: {in: [PURCHASE_INVOICE, SALES_INVOICE]}
}
){
edges {
node {
id
code
type
name
}
}
totalCount
pageInfo {
hasNextPage
}
}
}
Employees that have at least a phone different than mobile
query {
employees(where: { contacts: { some: { phones: { some: { type: { neq: MOBILE }}}}}}) {
edges {
node {
id
code
name
contacts {
name
surname
isDefault
phones {
type
number
}
}
}
}
totalCount
pageInfo {
hasNextPage
}
}
}
AccountingAccounts pagination, next 5 from endCursor
- new endCursor
filled in
query ($endCursor:String!) {
accountingAccounts (
order:{code:ASC}
first: 5
after: $endCursor
) {
edges {
node {
id
code
description
}
cursor
}
totalCount
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
}
}
AccountingEntries customer debit >=1000
& debit<=2000
query {
accountingEntries (
where :{
accountingEntryLines : {
some: {
and: [
{debitAmount: { gte: 1000}},
{debitAmount: { lte: 2000}},
{accountingEntryThirdParty: { origin: { eq: CUSTOMER } } }
]
}
}
}
){
edges {
node {
id
date
number
accountingEntryLines {
description
debitAmount
accountingEntryThirdParty{
code
}
}
}
}
totalCount
pageInfo {
hasNextPage
}
}
}
Dataloaders : SalesQuote containing a Specific Product with a Min Qty
query {
salesQuotes (
order: { documentDate: DESC },
where: {
and: [
{ documentDate: { gte: "2024-01-01" } },
{ documentDate: { lte: "2025-04-30" } },
{ lines: { some: {
and: [
{ productCode : {eq :"CLMENWATCH"}},
{ unitPrice: {gte : 5}},
]
}}}
]
}
) {
edges {
node {
id
socialName
operationalNumber
creationDate
customerId
customer {
id
code
vatNumber
salesDiscountGroupId
salesDiscountGroup{
code
name
}
}
documentDate
status
totalNet
discount
lines {
productCode
productName
totalQuantity
unitPrice
firstDiscount
totalNet
product {
id
salesUnitPrice
salesVatPercentage
}
}
}
}
totalCount
pageInfo {
hasNextPage
}
}
}
Aggregations: Sum of total Net and total Quantity of Sales Quote Lines by Product.
query {
salesQuoteLines (
first: 3
where: {
and: [
{ salesQuote: { documentDate: { gte: "2024-01-01" , lte: "2025-12-31" } } }
]
},
) {
edges {
node {
productId
salesQuote {
documentDate
}
totalQuantity
totalNet
}
}
aggregate(
aggregateFields: ["totalQuantity", "totalNet"],
groupFields: ["productId", "salesQuote.documentDate|Quarter"]
orderFields: ["totalQuantity|DESC"]
) {
groupValues {value}
aggregates {value}
}
}
}
Multi queries
query {
accountingExercises(
where: {status: {eq: OPEN}}
last:1
) {
edges {
node {
startDate
}
}
},
journalTypes(
where: {type: {eq: SALES_INVOICE}}
first:1) {
edges {
node {
code
name
id
}
}
},
documentTypes (where : { code : { eq : "01" }}) {
edges {
node {
id
code
name
legislationCode
}
}
},
customers (
where: {
code: {eq:"CARAT"}
disabled: {eq: false}
}
first:1
) {
edges {
node {
id
code
socialName
defaultAccountingAccountId
}
}
}
}