Skip to content

talon-one/TalonOneJavaSdk

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
api
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

talon-one-client

Talon.One API

  • API version:

Use the Talon.One API to integrate with your application and to manage applications and campaigns:

Determining the base URL of the endpoints

The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at https://yourbaseurl.talon.one/, the URL for the updateCustomerSessionV2 endpoint is https://yourbaseurl.talon.one/v2/customer_sessions/{Id}

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>one.talon</groupId>
  <artifactId>talon-one-client</artifactId>
  <version>5.0.3</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "one.talon:talon-one-client:5.0.3"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/talon-one-client-5.0.3.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

Integration API

Note: The Integration API's V1 Update customer session and Update customer profile endpoints are now deprecated. Use their V2 instead. See Migrating to V2 for more information.

package com.example.consumer;

import com.google.gson.Gson;

import one.talon.ApiClient;
import one.talon.api.IntegrationApi;
import one.talon.api.ManagementApi;
import one.talon.model.*;

public class TalonApiTest {
    public static void main(String[] args) {
        Gson gson = new Gson();
        IntegrationApi iApi = new IntegrationApi(new ApiClient("api_key_v1"));

        // Setup: basePath
        iApi.getApiClient().setBasePath("https://yourbaseurl.talon.one");
        // Setup: when using 'api_key_v1', set apiKey & apiKeyPrefix must be provided
        iApi.getApiClient().setApiKeyPrefix("ApiKey-v1");
        iApi.getApiClient().setApiKey("dbc644d33aa74d582bd9479c59e16f970fe13bf34a208c39d6c7fa7586968468");

        try {
          // Creating a cart item object
            CartItem cartItem = new CartItem();
            cartItem.setName("Hawaiian Pizza");
            cartItem.setSku("pizza-x");
            cartItem.setQuantity(1);
            cartItem.setPrice(new java.math.BigDecimal("5.5"));

            // Creating a customer session of V2
            NewCustomerSessionV2 customerSession = new NewCustomerSessionV2();
            customerSession.setProfileId("Cool_Dude");
            customerSession.addCouponCodesItem("Cool-Summer!");
            customerSession.addCartItemsItem(cartItem);

            // Initiating integration request wrapping the customer session update
            IntegrationRequest request = new IntegrationRequest()
                .customerSession(customerSession)
                // Optional parameter of requested information to be present on the response related to the customer session update
                .responseContent(Arrays.asList(
                    IntegrationRequest.ResponseContentEnum.CUSTOMERSESSION,
                    IntegrationRequest.ResponseContentEnum.CUSTOMERPROFILE
                ));

            // Flag to communicate whether the request is a "dry run"
            Boolean dryRun = false;

            // Create/update a customer session using `updateCustomerSessionV2` function
            IntegrationStateV2 is = iApi.updateCustomerSessionV2("deetdoot", request, dryRun);
            System.out.println(is.toString());

            // Parsing the returned effects list, please consult https://developers.talon.one/Integration-API/handling-effects-v2 for the full list of effects and their corresponding properties
            for (Effect eff : is.getEffects()) {
                if (eff.getEffectType().equals("addLoyaltyPoints")) {
                    // Typecasting according to the specific effect type
                    AddLoyaltyPointsEffectProps props = gson.fromJson(
                        gson.toJson(eff.getProps()),
                        AddLoyaltyPointsEffectProps.class
                    );
                    // Access the specific effect's properties
                    System.out.println(props.getName());
                    System.out.println(props.getProgramId());
                    System.out.println(props.getValue());
                }
                if (eff.getEffectType().equals("acceptCoupon")) {
                    // Typecasting according to the specific effect type
                    AcceptCouponEffectProps props = gson.fromJson(
                      gson.toJson(eff.getProps()),
                      AcceptCouponEffectProps.class
                    );
                    // work with AcceptCouponEffectProps' properties
                    // ...
                }
            }
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}

Management API

package com.example.consumer;

import one.talon.ApiClient;
import one.talon.api.IntegrationApi;
import one.talon.api.ManagementApi;
import one.talon.model.*;

public class TalonApiTest {
    public static void main(String[] args) {
        // Management API example to load application with id 7
        ManagementApi mApi = new ManagementApi(new ApiClient("management_key"));

        // Setup: basePath
        mApi.getApiClient().setBasePath("https://yourbaseurl.talon.one");
        // Setup: when using 'management_key', set apiKey & apiKeyPrefix must be provided
        mApi.getApiClient().setApiKeyPrefix("ManagementKey-v1");
        mApi.getApiClient().setApiKey("2f0dce055da01ae595005d7d79154bae7448d319d5fc7c5b2951fadd6ba1ea07");

        try {
            // Calling `getApplication` function with the desired id (7)
            Application application = mApi.getApplication(7);
            System.out.println(application.toString());
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://yourbaseurl.talon.one

Class Method HTTP request Description
IntegrationApi createAudienceV2 POST /v2/audiences Create audience
IntegrationApi createCouponReservation POST /v1/coupon_reservations/{couponValue} Create coupon reservation
IntegrationApi createReferral POST /v1/referrals Create referral code for an advocate
IntegrationApi createReferralsForMultipleAdvocates POST /v1/referrals_for_multiple_advocates Create referral codes for multiple advocates
IntegrationApi deleteAudienceMembershipsV2 DELETE /v2/audiences/{audienceId}/memberships Delete audience memberships
IntegrationApi deleteAudienceV2 DELETE /v2/audiences/{audienceId} Delete audience
IntegrationApi deleteCouponReservation DELETE /v1/coupon_reservations/{couponValue} Delete coupon reservations
IntegrationApi deleteCustomerData DELETE /v1/customer_data/{integrationId} Delete customer's personal data
IntegrationApi getCustomerInventory GET /v1/customer_profiles/{integrationId}/inventory List customer data
IntegrationApi getCustomerSession GET /v2/customer_sessions/{customerSessionId} Get customer session
IntegrationApi getLoyaltyBalances GET /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/balances Get customer's loyalty points
IntegrationApi getLoyaltyCardBalances GET /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/balances Get card's point balances
IntegrationApi getLoyaltyCardTransactions GET /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/transactions List card's transactions
IntegrationApi getLoyaltyProgramProfileTransactions GET /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/transactions List customer's loyalty transactions
IntegrationApi getReservedCustomers GET /v1/coupon_reservations/customerprofiles/{couponValue} List customers that have this coupon reserved
IntegrationApi linkLoyaltyCardToProfile POST /v2/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/link_profile Link customer profile to card
IntegrationApi reopenCustomerSession PUT /v2/customer_sessions/{customerSessionId}/reopen Reopen customer session
IntegrationApi returnCartItems POST /v2/customer_sessions/{customerSessionId}/returns Return cart items
IntegrationApi syncCatalog PUT /v1/catalogs/{catalogId}/sync Sync cart item catalog
IntegrationApi trackEventV2 POST /v2/events Track event
IntegrationApi updateAudienceCustomersAttributes PUT /v2/audience_customers/{audienceId}/attributes Update profile attributes for all customers in audience
IntegrationApi updateAudienceV2 PUT /v2/audiences/{audienceId} Update audience name
IntegrationApi updateCustomerProfileAudiences POST /v2/customer_audiences Update multiple customer profiles' audiences
IntegrationApi updateCustomerProfileV2 PUT /v2/customer_profiles/{integrationId} Update customer profile
IntegrationApi updateCustomerProfilesV2 PUT /v2/customer_profiles Update multiple customer profiles
IntegrationApi updateCustomerSessionV2 PUT /v2/customer_sessions/{customerSessionId} Update customer session
ManagementApi addLoyaltyCardPoints PUT /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/add_points Add points to card
ManagementApi addLoyaltyPoints PUT /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/add_points Add points to customer profile
ManagementApi copyCampaignToApplications POST /v1/applications/{applicationId}/campaigns/{campaignId}/copy Copy the campaign into the specified Application
ManagementApi createAccountCollection POST /v1/collections Create account-level collection
ManagementApi createAdditionalCost POST /v1/additional_costs Create additional cost
ManagementApi createAttribute POST /v1/attributes Create custom attribute
ManagementApi createCampaignFromTemplate POST /v1/applications/{applicationId}/create_campaign_from_template Create campaign from campaign template
ManagementApi createCollection POST /v1/applications/{applicationId}/campaigns/{campaignId}/collections Create collection
ManagementApi createCoupons POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons Create coupons
ManagementApi createCouponsAsync POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons_async Create coupons asynchronously
ManagementApi createCouponsForMultipleRecipients POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons_with_recipients Create coupons for multiple recipients
ManagementApi createNotificationWebhook POST /v1/applications/{applicationId}/notification_webhooks Create notification about campaign-related changes
ManagementApi createPasswordRecoveryEmail POST /v1/password_recovery_emails Request a password reset
ManagementApi createSession POST /v1/sessions Create session
ManagementApi deductLoyaltyCardPoints PUT /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/deduct_points Deduct points from card
ManagementApi deleteAccountCollection DELETE /v1/collections/{collectionId} Delete account-level collection
ManagementApi deleteCampaign DELETE /v1/applications/{applicationId}/campaigns/{campaignId} Delete campaign
ManagementApi deleteCollection DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId} Delete collection
ManagementApi deleteCoupon DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/coupons/{couponId} Delete coupon
ManagementApi deleteCoupons DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/coupons Delete coupons
ManagementApi deleteLoyaltyCard DELETE /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId} Delete loyalty card
ManagementApi deleteNotificationWebhook DELETE /v1/applications/{applicationId}/notification_webhooks/{notificationWebhookId} Delete notification about campaign-related changes
ManagementApi deleteReferral DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/referrals/{referralId} Delete referral
ManagementApi destroySession DELETE /v1/sessions Destroy session
ManagementApi exportAccountCollectionItems GET /v1/collections/{collectionId}/export Export account-level collection's items
ManagementApi exportCollectionItems GET /v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId}/export Export a collection's items
ManagementApi exportCoupons GET /v1/applications/{applicationId}/export_coupons Export coupons
ManagementApi exportCustomerSessions GET /v1/applications/{applicationId}/export_customer_sessions Export customer sessions
ManagementApi exportEffects GET /v1/applications/{applicationId}/export_effects Export triggered effects
ManagementApi exportLoyaltyBalance GET /v1/loyalty_programs/{loyaltyProgramId}/export_customer_balance Export customer loyalty balance to CSV
ManagementApi exportLoyaltyBalances GET /v1/loyalty_programs/{loyaltyProgramId}/export_customer_balances Export customer loyalty balances
ManagementApi exportLoyaltyCardBalances GET /v1/loyalty_programs/{loyaltyProgramId}/export_card_balances Export all card transaction logs
ManagementApi exportLoyaltyCardLedger GET /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/export_log Export card's ledger log
ManagementApi exportLoyaltyLedger GET /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/export_log Export customer's transaction logs
ManagementApi exportPoolGiveaways GET /v1/giveaways/pools/{poolId}/export Export giveaway codes of a giveaway pool
ManagementApi exportReferrals GET /v1/applications/{applicationId}/export_referrals Export referrals
ManagementApi getAccessLogsWithoutTotalCount GET /v1/applications/{applicationId}/access_logs/no_total Get access logs for Application
ManagementApi getAccount GET /v1/accounts/{accountId} Get account details
ManagementApi getAccountAnalytics GET /v1/accounts/{accountId}/analytics Get account analytics
ManagementApi getAccountCollection GET /v1/collections/{collectionId} Get account-level collection
ManagementApi getAdditionalCost GET /v1/additional_costs/{additionalCostId} Get additional cost
ManagementApi getAdditionalCosts GET /v1/additional_costs List additional costs
ManagementApi getAllAccessLogs GET /v1/access_logs List access logs
ManagementApi getAllRoles GET /v1/roles List roles
ManagementApi getApplication GET /v1/applications/{applicationId} Get Application
ManagementApi getApplicationApiHealth GET /v1/applications/{applicationId}/health_report Get Application health
ManagementApi getApplicationCustomer GET /v1/applications/{applicationId}/customers/{customerId} Get application's customer
ManagementApi getApplicationCustomerFriends GET /v1/applications/{applicationId}/profile/{integrationId}/friends List friends referred by customer profile
ManagementApi getApplicationCustomers GET /v1/applications/{applicationId}/customers List application's customers
ManagementApi getApplicationCustomersByAttributes POST /v1/applications/{applicationId}/customer_search List application customers matching the given attributes
ManagementApi getApplicationEventTypes GET /v1/applications/{applicationId}/event_types List Applications event types
ManagementApi getApplicationEventsWithoutTotalCount GET /v1/applications/{applicationId}/events/no_total List Applications events
ManagementApi getApplicationSession GET /v1/applications/{applicationId}/sessions/{sessionId} Get Application session
ManagementApi getApplicationSessions GET /v1/applications/{applicationId}/sessions List Application sessions
ManagementApi getApplications GET /v1/applications List Applications
ManagementApi getAttribute GET /v1/attributes/{attributeId} Get custom attribute
ManagementApi getAttributes GET /v1/attributes List custom attributes
ManagementApi getAudiences GET /v1/audiences List audiences
ManagementApi getCampaign GET /v1/applications/{applicationId}/campaigns/{campaignId} Get campaign
ManagementApi getCampaignAnalytics GET /v1/applications/{applicationId}/campaigns/{campaignId}/analytics Get analytics of campaigns
ManagementApi getCampaignByAttributes POST /v1/applications/{applicationId}/campaigns_search List campaigns that match the given attributes
ManagementApi getCampaignTemplates GET /v1/campaign_templates List campaign templates
ManagementApi getCampaigns GET /v1/applications/{applicationId}/campaigns List campaigns
ManagementApi getChanges GET /v1/changes Get audit logs for an account
ManagementApi getCollection GET /v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId} Get collection
ManagementApi getCollectionItems GET /v1/collections/{collectionId}/items Get collection items
ManagementApi getCouponsWithoutTotalCount GET /v1/applications/{applicationId}/campaigns/{campaignId}/coupons/no_total List coupons
ManagementApi getCustomerActivityReport GET /v1/applications/{applicationId}/customer_activity_reports/{customerId} Get customer's activity report
ManagementApi getCustomerActivityReportsWithoutTotalCount GET /v1/applications/{applicationId}/customer_activity_reports/no_total Get Activity Reports for Application Customers
ManagementApi getCustomerAnalytics GET /v1/applications/{applicationId}/customers/{customerId}/analytics Get customer's analytics report
ManagementApi getCustomerProfile GET /v1/customers/{customerId} Get customer profile
ManagementApi getCustomerProfiles GET /v1/customers/no_total List customer profiles
ManagementApi getCustomersByAttributes POST /v1/customer_search/no_total List customer profiles matching the given attributes
ManagementApi getEventTypes GET /v1/event_types List event types
ManagementApi getExports GET /v1/exports Get exports
ManagementApi getLoyaltyCard GET /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId} Get loyalty card
ManagementApi getLoyaltyCardTransactionLogs GET /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/logs List card's transactions
ManagementApi getLoyaltyCards GET /v1/loyalty_programs/{loyaltyProgramId}/cards List loyalty cards
ManagementApi getLoyaltyPoints GET /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId} Get customer's full loyalty ledger
ManagementApi getLoyaltyProgram GET /v1/loyalty_programs/{loyaltyProgramId} Get loyalty program
ManagementApi getLoyaltyProgramTransactions GET /v1/loyalty_programs/{loyaltyProgramId}/transactions List loyalty program transactions
ManagementApi getLoyaltyPrograms GET /v1/loyalty_programs List loyalty programs
ManagementApi getLoyaltyStatistics GET /v1/loyalty_programs/{loyaltyProgramId}/statistics Get loyalty program statistics
ManagementApi getNotificationWebhook GET /v1/applications/{applicationId}/notification_webhooks/{notificationWebhookId} Get notification about campaign-related changes
ManagementApi getNotificationWebhooks GET /v1/applications/{applicationId}/notification_webhooks List notifications about campaign-related changes
ManagementApi getReferralsWithoutTotalCount GET /v1/applications/{applicationId}/campaigns/{campaignId}/referrals/no_total List referrals
ManagementApi getRole GET /v1/roles/{roleId} Get role
ManagementApi getRuleset GET /v1/applications/{applicationId}/campaigns/{campaignId}/rulesets/{rulesetId} Get ruleset
ManagementApi getRulesets GET /v1/applications/{applicationId}/campaigns/{campaignId}/rulesets List campaign rulesets
ManagementApi getUser GET /v1/users/{userId} Get user
ManagementApi getUsers GET /v1/users List users in account
ManagementApi getWebhook GET /v1/webhooks/{webhookId} Get webhook
ManagementApi getWebhookActivationLogs GET /v1/webhook_activation_logs List webhook activation log entries
ManagementApi getWebhookLogs GET /v1/webhook_logs List webhook log entries
ManagementApi getWebhooks GET /v1/webhooks List webhooks
ManagementApi importAccountCollection POST /v1/collections/{collectionId}/import Import data in existing account-level collection
ManagementApi importAllowedList POST /v1/attributes/{attributeId}/allowed_list/import Import allowed values for attribute
ManagementApi importCollection POST /v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId}/import Import data in existing collection
ManagementApi importCoupons POST /v1/applications/{applicationId}/campaigns/{campaignId}/import_coupons Import coupons
ManagementApi importLoyaltyCards POST /v1/loyalty_programs/{loyaltyProgramId}/import_cards Import loyalty cards
ManagementApi importLoyaltyCustomersTiers POST /v1/loyalty_programs/{loyaltyProgramId}/import_customers_tiers Import customers into loyalty tiers
ManagementApi importLoyaltyPoints POST /v1/loyalty_programs/{loyaltyProgramId}/import_points Import loyalty points
ManagementApi importPoolGiveaways POST /v1/giveaways/pools/{poolId}/import Import giveaway codes into a giveaway pool
ManagementApi importReferrals POST /v1/applications/{applicationId}/campaigns/{campaignId}/import_referrals Import referrals
ManagementApi listAccountCollections GET /v1/collections List collections in account
ManagementApi listCatalogItems GET /v1/catalogs/{catalogId}/items List items in a catalog
ManagementApi listCollections GET /v1/applications/{applicationId}/campaigns/{campaignId}/collections List collections
ManagementApi listCollectionsInApplication GET /v1/applications/{applicationId}/collections List collections in application
ManagementApi notificationActivation PUT /v1/notifications/{notificationId}/activation Activate or deactivate notification
ManagementApi postAddedDeductedPointsNotification POST /v1/loyalty_programs/{loyaltyProgramId}/notifications/added_deducted_points Create notification about added or deducted loyalty points
ManagementApi postCatalogsStrikethroughNotification POST /v1/catalogs/{applicationId}/notifications/strikethrough Create strikethrough notification
ManagementApi postPendingPointsNotification POST /v1/loyalty_programs/{loyaltyProgramId}/notifications/pending_points Create notification about pending loyalty points
ManagementApi removeLoyaltyPoints PUT /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/deduct_points Deduct points from customer profile
ManagementApi resetPassword POST /v1/reset_password Reset password
ManagementApi searchCouponsAdvancedApplicationWideWithoutTotalCount POST /v1/applications/{applicationId}/coupons_search_advanced/no_total List coupons that match the given attributes (without total count)
ManagementApi searchCouponsAdvancedWithoutTotalCount POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons_search_advanced/no_total List coupons that match the given attributes in campaign (without total count)
ManagementApi transferLoyaltyCard PUT /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/transfer Transfer card data
ManagementApi updateAccountCollection PUT /v1/collections/{collectionId} Update account-level collection
ManagementApi updateAdditionalCost PUT /v1/additional_costs/{additionalCostId} Update additional cost
ManagementApi updateAttribute PUT /v1/attributes/{attributeId} Update custom attribute
ManagementApi updateCampaign PUT /v1/applications/{applicationId}/campaigns/{campaignId} Update campaign
ManagementApi updateCollection PUT /v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId} Update collection description
ManagementApi updateCoupon PUT /v1/applications/{applicationId}/campaigns/{campaignId}/coupons/{couponId} Update coupon
ManagementApi updateCouponBatch PUT /v1/applications/{applicationId}/campaigns/{campaignId}/coupons Update coupons
ManagementApi updateLoyaltyCard PUT /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId} Update loyalty card status
ManagementApi updateNotificationWebhook PUT /v1/applications/{applicationId}/notification_webhooks/{notificationWebhookId} Update notification about campaign-related changes
ManagementApi updateReferral PUT /v1/applications/{applicationId}/campaigns/{campaignId}/referrals/{referralId} Update referral

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

api_key_v1

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

management_key

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

manager_auth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author