v4.4.0: Customer Inventory Enhancements, Rule Failure Reasons and Import Endpoints
Summary
Management API
Expose import endpoints as integral part of the SDK
All of our CSV import endpoints are accessible via the Web Application from the corresponding entity pages (refer to our Help Center for an example regarding Coupons).
Now these are also available endpoints as part of the SDK (links to our developer docs):
Example code snippet demonstrating import coupons using a CSV file:
// ...preparing api client...
// An example could be seen at the repository's README file: https://github.com/talon-one/TalonOneJavaSdk#management-api
try {
Integer applicationId = 1;
Integer campaignId = 184;
File upFile = new File("path/to/coupons.csv");
ModelImport response = api.importCoupons(applicationId, campaignId, upFile);
} catch (FileNotFoundException e) {
System.out.println("CSV file was not found.");
e.printStackTrace();
} catch (Exception e) {
System.out.println("Error while importing coupons.");
System.out.println(e);
}
Introduce updateReferral
Endpoint
We introduced an endpoint to update referrals in order to allow updating their scheduling, usage limits and custom attributes attached to them.
Please consult the endpoint reference in our developer docs for more details.
Integration API
Improve Responses Transparency
We are constantly extending and improving our integration API to provide our consumers with the best transparency regarding what exactly has happened within their requests.
We have added new data points to our v2 endpoints effects in order to improve the transparency we aspire for:
- If an effect was triggered because of a specific coupon the effect will now include this coupon ID, see
Effect.md
- When a coupon is rejected we attach more details regarding the origin of the failure in
RejectCouponEffectProps
:conditionIndex
- The index of the condition that caused the rejection of the couponeffectIndex
- The index of the effect that caused the rejection of the coupondetails
- More details about the failure (if available)
- The same applies for referrals, when a referral is rejected we attach more details regarding the origin of the failure in
RejectReferralEffectProps
:conditionIndex
- The index of the condition that caused the rejection of the referraleffectIndex
- The index of the effect that caused the rejection of the referraldetails
- More details about the failure (if available)
Moreover, we have introduced a new response content, RuleFailureReasons
, which when requested will attach to the response a collection containing all failed rules, with details (see the RuleFailureReason
model to help narrowing down failures and further debugging efforts to a specific single condition or effect that caused the failure.
One "gotcha" to keep in mind: in order to maximize transparency, and due to the fact that we do not know in advance which campaign in the application the request targets, the list contains a collection of all failure reasons.
Meaning that, it might have "white noise" with data about failures that could be considered as "obvious" to the consumer. Therefore, we suggest always filtering the list by the campaign id that was expected to trigger and did not.
Extended Customer Inventory Endpoint
We have added a couple of useful data points to our customer inventory to make integration even simpler.
⚠️ ⚠️ It involves a breaking change when calling the operation
IntegrationApi apiInstance = new IntegrationApi(defaultClient);
String integrationId = "integrationId_example"; // String | The custom identifier for this profile, must be unique within the account.
Boolean profile = true; // Boolean | optional flag to decide if you would like customer profile information in the response
Boolean referrals = true; // Boolean | optional flag to decide if you would like referral information in the response
Boolean coupons = true; // Boolean | optional flag to decide if you would like coupon information in the response
Boolean loyalty = true; // Boolean | optional flag to decide if you would like loyalty information in the response
+Boolean giveaways = true; // Boolean | optional flag to decide if you would like giveaways information in the response
- CustomerInventory result = apiInstance.getCustomerInventory(integrationId, profile, referrals, coupons, loyalty);
+ CustomerInventory result = apiInstance.getCustomerInventory(integrationId, profile, referrals, coupons, loyalty, giveaways);
// ...
We are aware of the inconvenience, and as explained in #16, we are working on a better and improved implementation to avoid these breaking changes in the future.
As one can see, customer inventory now has the ability to return giveaway codes that belong to the profile in query.
In order to learn more about setting up such campaigns refer to this help center article and this developer docs tutorial.
We have also extended the coupons objects that are returned as part of the inventory and attached these two useful data-points to each returned coupon:
profileRedemptionCount
- holds the number of times the coupon was redeemed by the profilestate
- holds the state of the coupon and can be one of the below values:- active: reserved coupons that are neither pending nor used nor expired, and have a non-exhausted limit counter
- used: coupons that are not pending, and have reached their redemption limit or were redeemed by the profile before expiration
- expired: all non-pending, non-active, non-used coupons that were not redeemed by the profile
- pending: coupons that have a start date in the future
Attach Loyalty Program ID in responses
When the consumer requires that the response will contain the details of loyalty programs involved in processing the requests, we now attach the identifier of the loyalty program to the returned LoyaltyProgramLedgers
models.
The idea behind attaching the identifier is to help streamline further potential requests to our Management API with regard to details about a Loyalty Program, for example getLoyaltyStatistics or getLoyaltyPoints, that require the program identifier as part of the URI of the endpoint.
⚠️ A reminder of The Deprecation Notice: Integration API@v1 endpoints
The deprecation was introduced already in the last release of the SDK, here is a kind reminder of the deprecation notices for Integration API@v1 endpoints:
These endpoints will be flagged deprecated on 15.07.2021, meaning support for requests to these endpoints will end on that date. We will not remove the endpoints, and they will still be accessible for you to use.
We highly encourage migrating to the correspondent v2 endpoints for easier and more granular integration, as well as new features support (See our developer docs section about API V2.0).