Skip to main content

Examples

Runnable Java examples for the Candescent Digital Insight API are available in the cdx-java-sdk repository. Clone the repo to explore recommended SDK usage patterns against the Stage environment. Examples cover the same API areas as the TypeScript SDK examples.

Clone and install

Bash
git clone https://github.com/candescent-dev/cdx-java-sdk.git
cd cdx-java-sdk/examples/java
mvn compile

The Maven project is examples/java/ (cdx-java-sdk/examples/java). mvn compile downloads com.candescent.forge:di-java-sdk from Maven Central and compiles the example classes. Copy .env at the repo root (see below).

Environment setup

From the repo root:

Bash
cp .env.example .env

Generate your credentials using the values provided in the Developer Console quickstart guide.

VariableRequiredDescription
CANDESCENT_INSTITUTION_IDYesInstitution identifier
CANDESCENT_CLIENT_IDYes*OAuth 2.0 client ID
CANDESCENT_CLIENT_SECRETYes*OAuth 2.0 client secret
CANDESCENT_BEARER_TOKENYes*Pre-obtained JWT (skips OAuth)
CANDESCENT_ENVIRONMENTNostage (default), sandbox, or production

*Provide either CANDESCENT_BEARER_TOKEN or both CANDESCENT_CLIENT_ID and CANDESCENT_CLIENT_SECRET.

See .env.example for example-specific variables (account IDs, business banking, MX, alerts, and more).

Optional example variables

VariableUsed for
CANDESCENT_HOST_USER_IDRetail examples (hostUserId)
CANDESCENT_LOGIN_IDRetail examples (loginId)
CANDESCENT_ACCOUNT_IDAccount-specific examples
CANDESCENT_CUSTOMER_IDCustomer lookup examples
CANDESCENT_BB_CLIENT_ID / CANDESCENT_BB_CLIENT_SECRET / CANDESCENT_BB_INSTITUTION_IDBusiness banking examples
CANDESCENT_MX_CLIENT_ID / CANDESCENT_MX_CLIENT_SECRET / CANDESCENT_MX_INSTITUTION_IDMX integration examples

Load credentials into your shell before running a single example manually:

Bash
set -a && source .env && set +a   # bash / zsh
note

Individual examples do not auto-load .env. Either source it manually (as above) or use the batch runner below.

Run a single example

Bash
cd examples/java
mvn exec:java -Dexec.mainClass="com.candescent.examples.AccountsExample"

Replace AccountsExample with any class from the catalog below.

Run all examples

From the repo root:

Bash
bash scripts/run-all-java-examples.sh

Output is appended to logs/all-examples.log of the cdx-java-sdk repo. The process exits non-zero if any example fails.

DetailValue
Default loglogs/all-examples.log
Custom logbash scripts/run-all-java-examples.sh --log=/tmp/java-examples.log
CredentialsEnvironment variables or repo-root .env (loaded automatically by the batch runner)

Run ErrorHandlingExample individually — it exercises intentional failures and is excluded from the batch runner. From examples/java/:

Bash
mvn exec:java -Dexec.mainClass="com.candescent.examples.ErrorHandlingExample"

Add the SDK to your own project

To use the SDK outside the examples repo, add the Maven dependency from Installation to your application pom.xml.

Example catalog

For teams using both SDKs, each Java class maps to a TypeScript script in cdx-typescript-sdk.

Example classTypeScript equivalentWhat it covers
AccountsExampleaccounts.tsList accounts, retrieve account details
TransactionsExampletransactions.tsTransaction history, filtering
AuthenticationExampleauthentication.tsOAuth token lifecycle
AuthenticationLifecycleExampleauthentication-lifecycle.tsFull token creation, revoke flow
CustomerManagementExamplecustomer-management.tsContact methods, password reset, unlock
RegisterAndLookupExampleregister-and-lookup.tsCustomer registration, search
DisclosuresExampledisclosures.tsInstitution and user disclosures
EstatementsExampleestatements.tsE-statement delivery preferences
AlertConfigurationExamplealert-configuration.tsAlert templates and types
AlertPreferencesExamplealert-preferences.tsUser and institution alert preferences
AlertDeliveryExamplealert-delivery.tsAlert history and content
NotificationChannelsExamplenotification-channels.tsSubscription management
BusinessRegistrationExamplebusiness-registration.tsBusiness banking registration
BusinessEntitlementsExamplebusiness-entitlements.tsBusiness and user entitlements
BusinessPaymentsExamplebusiness-payments.tsACH and wire payments
CustomerCampaignsExamplecustomer-campaigns.tsExperience groups and campaigns
MoneyMovementExamplemoney-movement.tsRecipients and transfers
MxServiceExamplemx-service.tsMX integration — widget, users, logs
PaginationExamplepagination.tsPageIterator patterns
ErrorHandlingExampleerror-handling.tsError hierarchy showcase
UserStatusExampleuser-status.tsUser authentication status

Example to operation coverage

All API operations are covered by these examples.

API tagExample class(es)Operations covered
AccountsAccountsExample, TransactionsExampleList, get, banking images, activities, list transactions
Alert ConfigurationAlertConfigurationExampleTemplates, types, institution types CRUD
Alert DeliveryAlertDeliveryExampleHistory, content, publish events
Alert PreferencesAlertPreferencesExampleUser + institution preference CRUD
AuthenticationAuthenticationExample, AuthenticationLifecycleExampleAuthorize, legacy token, auth code, create/revoke token
Business BankingBusinessRegistrationExample, BusinessEntitlementsExample, BusinessPaymentsExampleRegistration, entitlements, ACH/Wire
Customer CampaignsCustomerCampaignsExampleExperience groups, jobs, user lists
Customer ManagementRegisterAndLookupExample, UserStatusExample, CustomerManagementExampleRegister, lookups, contact, password, unlock
Documents & PreferencesDisclosuresExample, EstatementsExampleDisclosure CRUD, e-statement prefs/report
MXMxServiceExampleUsers, widget URL, transaction logs
Money MovementMoneyMovementExampleRecipients and transfers
Notification ChannelsNotificationChannelsExampleSubscriptions CRUD and send event
Cross-cuttingErrorHandlingExample, PaginationExampleError hierarchy, pagination patterns