HomeGuidesDeveloper HubRelease Notes
Get supportBook a chat
Developer Hub
These docs are for v2.114. Click to read the latest docs for v2.208.

FieloPLT.RewardAPI Class

Generally used for the Rewards Catalog component, the FieloPLT.RewardAPI Class includes one method.

Get Rewards (getRewards)

List<FieloPLT__Reward__c> FieloPLT.RewardAPI.getRewards(Id memberId, List<String> fields, Set<Id> rewardIds, Boolean filterBySegment, Integer quantity, Integer offset, String dynamicFilter, String orderBy)

This method will deliver to the member a list of all the rewards available to them, for consultation purpose. The API identifies the member through their ID and searches for those rewards that they can redeem based on their segment - which is one of the aspects that can stop members from being able to redeem a reward.

It is a great way of showing to the member, in an objective way, what are the prizes that they can acquire using the Currencies that they are gathering by participating in your Incentives.

Take a look at a step by step guide on how to use this method.

Parameters

Check an example of how the API can be used below and a definition of its parameters right after:

Id memberId = [SELECT Id FROM FieloPLT__Member__c LIMIT 1].Id;
List<String> fieldsReward = new List<String>{'Name', 'Id'};
Set<Id> rewardIds = new Set<Id>(); //Empty to get all members rewards
Boolean filterBySegment = false;
Integer quantity = 10;
Integer offset = 0;
String orderBy = 'Name';
String dynamicFilter = null;

List<Reward__c> result = FieloPLT.RewardAPI.getRewards(memberId, fieldsReward, rewardIds, filterBySegment, quantity, offset, orderBy, dynamicFilter);
ParametersTypeDescriptionRequired
memberIdIdID of a specific member.Yes
fieldsList<String>

A list of the API field names from the Reward Object that you want to be returned. E.g. FieloPLT__ExpirationDate__c.

If null, returns only Id and Name.

No
rewardIdsSet<Id>A set of the rewards' IDs that you want to be added to the return. If null, will return all rewards available to the member.No
filterBySegmentBooleanIf (true), it filters the rewards available for redemption based on the member's segment(s).No
quantityIntegerMaximum number of rewards to be retrieved.No
offsetIntegerNumber of records from the collection to skip.No
dynamicFilterStringDefine fields from the Reward object that the member can use as filters. E.g. FieloPLT__PayoutDate__c, Name, FieloPLT__Currency__c.No
orderByStringDefine a field from the Payout object to be used as a base to order the records returned. If null, it returns with Salesforce's default.No

Return Value

Take a look below at an example of what is returned in the call and a definition of the return values right after:

List<Reward__c> result =
    [{"attributes":{"type":"FieloPLT__Reward__c","url":"/services/data/v51.0/sobjects/FieloPLT__Reward__c/a0x1k000001BQUZAA4"},
TypeDescription
List<FieloPLT__Reward__c>List of the rewards that the member can redeem.

Exceptions

Errors can occur when you use the endpoint. Use the message description to troubleshoot them.

TypeDescription
FieloApiException
  • Parameter {memberid} is necessary.* When Member ID is either invalid or empty.