Skip to content
Developer home
X3

Example GraphQL queries for Customers

  Less than to read

First five customers sorted by code in ascending order, with pagination

{
  sage {
    x3BusinessPartners {
      customer(orderBy: "{ code: 1  }", first: 5) {
        edges {
          node {
            code
            companyName
          }
          cursor
        }
        pageInfo {
          endCursor
          hasNextPage
        }
      }
    }
  }
}

Try it on our demo endpoint

First five customers sorted by code in ascending order, after specified cursor value (obtained from previous query)

{
  sage {
    x3BusinessPartners {
      customer(orderBy: "{ code: 1  }", first: 5, after : "[\"AO005\"]#40") {
        edges {
          node {
            code
            companyName
          }
          cursor
        }
        pageInfo {
          endCursor
          hasNextPage
        }
      }
    }
  }
}

Try it on our demo endpoint

Customer detail from country name on the billing address

{
  sage {
    x3BusinessPartners {
      customer (filter: "{ billToCustomer: { billToCustomerAddress: {countryName :{ $in: ['Australia', 'France'] } } }} "){
        edges {
          node {
            code
            companyName
            shortCompanyName
            category {
              code
              mustPrintAcknowledgment
            }
            customerType
            billToCustomer {
              code
              companyName
              shortCompanyName
              customerType
              billToCustomerAddress {
                entityType
                entity
                address
                description
                defaultBankId
                isDefault
                city
                countryName
                fax
                cellPhone
                externalIdentifier
                website
                isValid
                federalId
                exportNumber
              }
              payByCustomerAddress {
                entityType
                entity
                address
                description
                defaultBankId
                isDefault
                city
                countryName
                fax
                cellPhone
                externalIdentifier
                website
                isValid
                federalId
                exportNumber
              }
            }
          }
        }
      }
    }
  }
}

Try it on our demo endpoint

Read the default values for a dedicated customer category

{
  sage {
    x3BusinessPartners {
      customerCategory(filter: "{code : 'US'}") {
        edges {
          node {
            code
            localizedDescription
            localizedShortDescription
            creationMethod
            country {
              code
            }
            language {
              code
            }
            creditControl
            authorizedCreditAmount
            accountingCode
            paymentTermCode
            taxRuleCode
            invoicingTerm
            currency {
              code
            }
            customerStatisticalGroups {
              edges {
                node {
                  value {
                    glossaryId {
                      glossaryId
                    }
                    code
                  }
                }
              }
            }
            percentageOrAmountOfInvoicingElements
            analyticalDimensions {
              edges {
                node {
                  type {
                    code
                  }
                  value {
                    code
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Try it on our demo endpoint

Read the last customer transaction for a dedicated customer

{
  sage {
    x3BusinessPartners {
      lastCustomerTransaction(filter: "{customer : 'FR001', company : 'FR10'}") {
        edges {
          node {
            customer {
              code
              companyNames
            }
            customerTransactionType
            customerInformationType
            documentNumber
            documentDate
            amount
            currency {
              code
            }
          }
        }
      }
    }
  }
}

Try it on our demo endpoint