Reward management lets the developers assign and redeem rewards. The services Game, Score, ScoreBoard, Reward, Reward Points, Achievement, Gifting, etc can be used in conjunction to implement a game center. Operations are also available to get Top Reward Earners, Top in Groups/Buddy list etc.
import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.App42Response; import com.shephertz.app42.paas.sdk.android.App42API; import com.shephertz.app42.paas.sdk.android.game.Reward; import com.shephertz.app42.paas.sdk.android.game.RewardService;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.game;#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"#import<Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h>import com.shephertz.app42.paas.sdk.java.App42BadParameterException; import com.shephertz.app42.paas.sdk.java.App42Exception; import com.shephertz.app42.paas.sdk.java.App42NotFoundException; import com.shephertz.app42.paas.sdk.java.App42Response; import com.shephertz.app42.paas.sdk.java.App42API; import com.shephertz.app42.paas.sdk.java.game.Reward; import com.shephertz.app42.paas.sdk.java.game.RewardService;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.game;<script type="text/javascript" src="App42-all-x.x.x.min.js"></script>local App42API = require("App42-Lua-API.App42API")#include "App42API.h"using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.game;include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php'; include_once '../App42Log.php'; include_once '../RewardService.php';#include "App42API.h"require 'App42_Ruby_API'import com.shephertz.app42.paas.sdk.as3.App42API; import com.shephertz.app42.paas.sdk.as3.App42Response; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42BadParameterException; import com.shephertz.app42.paas.sdk.as3.App42NotFoundException; import com.shephertz.app42.paas.sdk.as3.game.Reward; import com.shephertz.app42.paas.sdk.as3.game.RewardService;Coming Soonimport com.shephertz.app42.paas.sdk.jme.App42BadParameterException; import com.shephertz.app42.paas.sdk.jme.App42Exception; import com.shephertz.app42.paas.sdk.jme.App42NotFoundException; import com.shephertz.app42.paas.sdk.jme.App42Response; import com.shephertz.app42.paas.sdk.jme.App42API; import com.shephertz.app42.paas.sdk.jme.game.Reward; import com.shephertz.app42.paas.sdk.jme.game.RewardService;
In order to use various the functions available in a specific API, a developer has to initialize with App42API by passing the apiKey and secretKey which will be created after the app creation from AppHQ dashboard.
Required Parameters
apiKey - The Application key given when the application was created.
secretKey - The secret key corresponding to the application key given when the application was created.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42.initialize("API_KEY","SECRET_KEY");App42API:initialize("API_KEY","SECRET_KEY")App42API:Initialize("API_KEY","SECRET_KEY")App42API.Initialize("API_KEY","SECRET_KEY");App42API::initialize("API_KEY","SECRET_KEY");App42API:Initialize("API_KEY","SECRET_KEY")api = App42::ServiceAPI.new("API_KEY","SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");Coming SoonApp42API.initialize("API_KEY","SECRET_KEY");
After initialization, developer needs to call the buildXXXService method on App42API to get the instance of the particular API that you wish to build. For example, To build an instance of GameService, buildGameService() method needs to be called.
RewardService rewardService = App42API.buildRewardService();RewardService rewardService = App42API.BuildRewardService();RewardService *rewardService = [App42API buildRewardService];let rewardService = App42API.buildRewardService() as? RewardServiceRewardService rewardService = App42API.buildRewardService();RewardService rewardService = App42API.BuildRewardService();var rewardService = new App42Reward();local rewardService = App42API:buildRewardService()RewardService *rewardService = App42API::BuildRewardService();RewardService rewardService = App42API.BuildRewardService();$rewardService = App42API::buildRewardService();RewardService *rewardService = App42API::BuildRewardService();reward_service = api.build_reward_servicevar rewardService:RewardService = App42API.buildRewardService();Coming SoonRewardService rewardService = App42API.buildRewardService();
Creates Reward. Reward can be Sword, Energy etc. When Reward Points have to be added the Reward name created using this method has to be specified.
Required Parameters
rewardName - The reward that has to be created.
description - The description of the reward to be created.
String rewardName = "<Enter_your_reward_name>"; String description = "description"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.createReward(rewardName , description, new App42CallBack() { public void onSuccess(Object response) { Reward reward = (Reward)response; System.out.println("rewardName is " + reward.getName()); System.out.println("rewardDescription is " + reward.getDescription()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String rewardName = "<Enter_your_reward_name>"; String description = "description"; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.CreateReward(rewardName, description,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Reward reward = (Reward) response; Console.WriteLine("rewardName is " + reward.GetName()); Console.WriteLine("rewardDescription is " + reward.GetDescription()); String jsonResponse = reward.ToString(); } }NSString *rewardName = @"<Enter_your_game_name>"; NSString *description = @"description"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService createReward:rewardName rewardDescription:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Reward *reward = (Reward*)responseObj; NSLog(@"rewardName is = %@" reward.name); NSLog(@"rewardDescription is = %@",reward.description); NSString *jsonResponse = [reward toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let rewardName = "Enter_your_reward_name>" let description = "description" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.createReward(rewardName, rewardDescription: description, completionBlock: { (success, response, exception) -> Void in if(success) { let reward = response as! Reward NSLog("%@", reward.name) NSLog("%@", reward.description) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String rewardName = "<Enter_your_reward_name>"; String description = "description"; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Reward reward = rewardService.createReward(rewardName, description); System.out.println("rewardName is " + reward.getName()); System.out.println("rewardDescription is " + reward.getDescription()); String jsonResponse = reward.toString();String rewardName = "<Enter_your_reward_name>"; String description = "description"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.CreateReward(rewardName, description, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Reward reward = (Reward) response; App42Log.Console("rewardName is " + reward.GetName()); App42Log.Console("rewardDescription is " + reward.GetDescription()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var rewardName = "<Enter_your_reward_name>", description = "<Enter_your_description>", result ; App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.createReward(rewardName, description,{ success: function(object) { var reward = JSON.parse(object); result = reward.app42.response.rewards.reward; console.log("Reward Name : " + result.name) console.log("Reward Description : " + result.description) }, error: function(error) { } });local rewardName = "<Enter_your_reward_name>" local description = "<Enter_your_description>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:createReward(rewardName,description,App42CallBack) function App42CallBack:onSuccess(object) print("rewardName is "..object:getName()) print("rewardDescription is "..object:getDescription()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* rewardName = "<Enter_your_reward_name>"; const char* description = "<Enter_your_description>"; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->CreateReward(rewardName, description, app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name:%s",it->name.c_str()); printf("\nDescription:%s",it->description.c_str()); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }String rewardName = "<Enter_your_reward_name>"; String description = "description"; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); Reward reward = rewardService.CreateReward(rewardName, description); Console.WriteLine("rewardName is " + reward.GetName()); Console.WriteLine("rewardDescription is " + reward.GetDescription()); String jsonResponse = reward.ToString();$rewardName = "<Enter_your_reward_name>"; $description = "description"; App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $reward = $rewardService->createReward($rewardName,$description); print_r("rewardName is " . $reward->getName()); print_r("rewardDescription is " . $reward->getDescription()); $jsonResponse = $reward->toString();const char* rewardName = "<Enter_your_reward_name>"; const char* description = "<Enter_your_description>"; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->CreateReward(rewardName, description, this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name:%s",it->name.c_str()); printf("\nDescription:%s",it->description.c_str()); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }reward_name = "<Enter_your_reward_name>"; description = "description"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") reward_service = api.build_reward_service reward = reward_service.create_reward(rewardName, description); puts "rewardName is #{reward.name}"; puts "rewardDescription is #{reward.description}"; json_response = reward.to_s();var rewardName:String = "<Enter_your_reward_name>"; var description:String = "description"; App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.createReward(rewardName, description,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var reward:Reward = Reward(response); trace("rewardName is " + reward.getName()); trace("rewardDescription is " + reward.getDescription()); } }Coming SoonString rewardName = "<Enter_your_reward_name>"; String description = "description"; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Reward reward = rewardService.createReward(rewardName, description); System.out.println("rewardName is " + reward.getName()); System.out.println("rewardDescription is " + reward.getDescription()); String jsonResponse = reward.toString();
Fetches all the Rewards
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.getAllRewards(new App42CallBack() { public void onSuccess(Object response) { ArrayList<Reward> reward = (ArrayList<Reward>)response; for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is " + reward.get(i).getName()); System.out.println("rewardDescription is " + reward.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetAllRewards(new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Reward> reward = (List<Reward>) response; Console.WriteLine("rewardName is " + reward[0].GetName()); Console.WriteLine("rewardDescription is " + reward[0].GetDescription()); String jsonResponse = reward[0].ToString(); } }[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService getAllRewards:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *rewardArray = (NSArray*)responseObj; for(Reward *reward in rewardArray){ NSLog(@"rewardName is = %@" reward.name); NSLog(@"rewardDescription is = %@",reward.description); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.getAllRewards( { (success, response, exception) -> Void in if(success) { let list = response as! NSArray for reward in list { NSLog("%@", reward.name) NSLog("%@", reward.description) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); ArrayList<Reward> reward = rewardService.getAllRewards(); for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is " + reward.get(i).getName()); System.out.println("rewardDescription is " + reward.get(i).getDescription()); } String jsonResponse = reward.get(0).toString();App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetAllRewards(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result ; App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.getAllRewards({ success: function (object) { var reward = JSON.parse(object); result = reward.app42.response.rewards.reward; if (result instanceof Array) { for (var i = 0; i < result.length; i++) { console.log("Reward Name : " + result[i].name) console.log("Reward Description : " + result[i].description) } } else { console.log("Reward Name : " + result.name) console.log("Reward Description : " + result.description) } }, error: function (error) { } });local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:getAllRewards(App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) >1 then for i=1,table.getn(object) do print("rewardName is "..object[i]:getName()) print("rewardDescription is "..object[i]:getDescription()) end else print("rewardName is "..object:getName()) print("rewardDescription is "..object:getDescription()) end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endApp42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetAllRewards(app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name:%s",it->name.c_str()); printf("\nDescription:%s",it->description.c_str()); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); IList<Reward> reward = rewardService.GetAllRewards(); Console.WriteLine("rewardName is " + reward[0].GetName()); Console.WriteLine("rewardDescription is " + reward[0].GetDescription()); String jsonResponse = reward[0].ToString();App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $rewardResponse = $rewardService->getAllRewards(); foreach ($rewardResponse as $reward) { print_r("name is" . $reward->getName()); print_r("description is" . $reward->getDescription()); } $jsonResponse = $rewardResponse[0]->toString();App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetAllRewards(this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name:%s",it->name.c_str()); printf("\nDescription:%s",it->description.c_str()); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }reward_list = Array.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") reward_service = api.build_reward_service reward_list = reward_service.get_all_rewards(); for reward in reward_list do puts "rewardName is #{reward.name}"; puts "rewardDescription is #{reward.description}"; end json_response = reward_list.to_s();App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.getAllRewards(new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var reward:Reward = Reward(response); trace("response is : " + reward); } }Coming SoonApp42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Vector reward = rewardService.getAllRewards(); System.out.println("rewardName is " + ((Reward)reward.elementAt(0)).getName()); System.out.println("rewardDescription is " + ((Reward)reward.elementAt(0)).getDescription()); String jsonResponse = ((Reward)reward.elementAt(0)).toString();
Fetches the count of all the Rewards.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.getAllRewardsCount(new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Total Records : " + app42response.getTotalRecords()) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetAllRewardsCount(new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response response = (App42Response) response; String jsonResponse = response.ToString(); } }[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService getAllRewardsCount:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.getAllRewardsCount( { (success, response, exception) -> Void in if(success) { let reward = response as! App42Response NSLog("%@", reward.strResponse) NSLog("%d", reward.totalRecords) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); App42Response app42response = rewardService.getAllRewardsCount(); System.out.println("Total Records : " + app42response.getTotalRecords()) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetAllRewardsCount(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result ; App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.getAllRewardsCount({ success: function (object) { var reward = JSON.parse(object); result = reward.app42.response; console.log("Total Records : " + result.totalRecords) }, error: function (error) { } });local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:getAllRewardsCount(App42CallBack) function App42CallBack:onSuccess(object) print("Total Records is "..object:getTotalRecords()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endApp42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetAllRewardsCount(app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { printf("\nTotalRecords=%d",rewardResponse->getTotalRecords()); } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); App42Response response = rewardService.GetAllRewardsCount(); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $response = $rewardService->getAllRewardsCount(); print_r("Total Records : ".$response->getTotalRecords()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetAllRewardsCount(this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { printf("\nTotalRecords=%d",rewardResponse->getTotalRecords()); } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") reward_service = api.build_reward_service response = reward_rervice.get_all_rewards_count(); success = response.is_response_success(); total_records = response.total_records(); json_rsesponse = response.to_s();App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.getAllRewardsCount(new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var reward:Reward = Reward(response); trace("response is : " + reward); } }Coming SoonApp42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); App42Response response = rewardService.getAllRewardsCount(); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Fetches all the rewards by paging.
Required Parameters
max - Maximum number of records to be fetched.
offset - From where the records are to be fetched.
int max = 1; int offset = 0 ; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.getAllRewards(max, offset,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Reward> reward = (ArrayList<Reward>)response; for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is " + reward.get(i).getName()); System.out.println("rewardDescription is " + reward.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });int max = 1; int offset = 0 ; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetAllRewards(max,offset,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Reward> reward = (List<Reward>) response; Console.WriteLine("rewardName is " + reward[0].GetName()); Console.WriteLine("rewardDescription is " + reward[0].GetDescription()); String jsonResponse = reward[0].ToString(); } }int max = 1; int offset = 0 ; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService getAllRewards:max offset:offset completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *rewardArray = (NSArray*)responseObj; for(Reward *reward in rewardArray){ NSLog(@"rewardName is = %@" reward.name); NSLog(@"rewardDescription is = %@",reward.description); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let max:Int32 = 11 let offset:Int32 = 0 App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.getAllRewards(max, offset: offset, completionBlock: { (success, response, exception) -> Void in if(success) { let list = response as! NSArray for reward in list { NSLog("%@", reward.name) NSLog("%@", reward.description) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })int max = 1; int offset = 0 ; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); ArrayList<Reward> reward = rewardService.getAllRewards(max,offset); for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is " + reward.get(i).getName()); System.out.println("rewardDescription is " + reward.get(i).getDescription()); } String jsonResponse = reward.get(0).toString();int max = 1; int offset = 0 ; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetAllRewards(max,offset, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var max = 10, offset = 0 , result ; App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.getAllRewardsWithPaging(max, offset, { success: function (object) { var rewardObj = JSON.parse(object); result = rewardObj.app42.response.rewards.reward; if (result instanceof Array) { for (var i = 0; i < result.length; i++) { console.log("Reward Name : " + result[i].name) console.log("Reward Description : " + result[i].description) } } else { console.log("Reward Name : " + result.name) console.log("Reward Description : " + result.description) } }, error: function (error) { } });local max = 5 local offset = 0 local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:getAllRewardsWithPaging(max,offset,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) >1 then for i=1,table.getn(object) do print("rewardName is "..object[i]:getName()) print("rewardDescription is "..object[i]:getDescription()) end else print("rewardName is "..object:getName()) print("rewardDescription is "..object:getDescription()) end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endint max =1; int offset = 0; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetAllRewards(max, offset, app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name:%s",it->name.c_str()); printf("\nDescription:%s",it->description.c_str()); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }int max = 1; int offset = 0 ; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); IList<Reward> reward = rewardService.GetAllRewards(max,offset); Console.WriteLine("rewardName is " + reward[0].GetName()); Console.WriteLine("rewardDescription is " + reward[0].GetDescription()); String jsonResponse = reward[0].ToString();$max = 1; $offset = 0 ; App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $rewardResponse = $rewardService->getAllRewards($max,$offset); foreach ($rewardResponse as $reward) { print_r("name is" . $reward->getName()); print_r("description is" . $reward->getDescription()); } $jsonResponse = $rewardResponse[0]->toString();int max =1; int offset = 0; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetAllRewards(max, offset, this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name:%s",it->name.c_str()); printf("\nDescription:%s",it->description.c_str()); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }max = 1; offset = 0; reward_list = Array.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") reward_service = api.build_reward_service reward_list = reward_service.get_all_rewards_by_paging(max,offset); for album in album_list do puts "rewardName is #{reward.name}"; puts "rewardDescription is #{reward.description}"; end json_response = reward_list.to_s();var max:int = 5; var offset:int = 1; App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.getAllRewards(max,offset,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var reward:Reward = Reward(response); trace("response is : " + reward); } }Coming SoonInteger max = new Integer(1); Integer offset = new Integer(0); App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Vector reward = rewardService.getAllRewards(max,offset); System.out.println("rewardName is " + ((Reward)reward.elementAt(0)).getName()); System.out.println("rewardDescription is " + ((Reward)reward.elementAt(0)).getDescription()); String jsonResponse = ((Reward)reward.elementAt(0)).toString();
Fetch the reward by the specified name.
Required Parameters
rewardName - Name of the reward that has to be fetched.
String rewardName = "<Enter_your_reward_name>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.getRewardByName(rewardName, new App42CallBack() { public void onSuccess(Object response) { Reward reward = (Reward)response; System.out.println("rewardName is " + reward.getName()); System.out.println("rewardDescription is " + reward.getDescription()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String rewardName = "<Enter_your_reward_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetRewardByName(rewardName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Reward reward = (Reward) response; Console.WriteLine("rewardName is " + reward.GetName()); Console.WriteLine("rewardDescription is " + reward.GetDescription()); String jsonResponse = reward.ToString(); } }NSString *rewardName = @"<Enter_your_reward_name>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService getRewardByName:rewardName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Reward *reward = (Reward*)responseObj; NSLog(@"rewardName is = %@" reward.name); NSLog(@"rewardDescription is = %@",reward.description); NSString *jsonResponse = [reward toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let rewardName = "<Enter_your_reward_name>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.getRewardByName(rewardName, completionBlock: { (success, response, exception) -> Void in if(success) { let reward = response as! Reward NSLog("%@", reward.name) NSLog("%@", reward.description) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String rewardName = "<Enter_your_reward_name>"; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Reward reward = rewardService.getRewardByName(rewardName); System.out.println("rewardName is " + reward.getName()); System.out.println("rewardDescription is " + reward.getDescription()); String jsonResponse = reward.toString();String rewardName = "<Enter_your_reward_name>"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetRewardByName(rewardName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var rewardName = "<Enter_your_reward_name>", result ; App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.getRewardByName(rewardName,{ success: function(object) { var reward = JSON.parse(object); result = reward.app42.response.rewards.reward; console.log("Reward Name : " + result.name) console.log("Reward Description : " + result.description) }, error: function(error) { } });local rewardName = "<Enter_your_reward_name>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:getRewardByName(rewardName,App42CallBack) function App42CallBack:onSuccess(object) print("rewardName is "..object:getName()) print("rewardDescription is "..object:getDescription()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* rewardName = "<Enter_your_reward_name>"; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetRewardByName(rewardName, app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name:%s",it->name.c_str()); printf("\nDescription:%s",it->description.c_str()); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }String rewardName = "<Enter_your_reward_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); Reward reward = rewardService.GetRewardByName(rewardName); Console.WriteLine("rewardName is " + reward.GetName()); Console.WriteLine("rewardDescription is " + reward.GetDescription()); String jsonResponse = reward.ToString();$rewardName = "<Enter_your_reward_name>"; App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $reward = $rewardService->getRewardByName($rewardName); print_r("rewardName is " . $reward->getName()); print_r("rewardDescription is " . $reward->getDescription()); $jsonResponse = $reward->toString();const char* rewardName = "<Enter_your_reward_name>"; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetRewardByName(rewardName, this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name:%s",it->name.c_str()); printf("\nDescription:%s",it->description.c_str()); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }reward_name = "<Enter_your_reward_name>"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") reward_service = api.build_reward_service reward = reward_service.get_reward_by_name(reward_name); puts "rewardName is #{reward.name}"; puts "rewardDescription is #{reward.description}"; json_response = reward.to_s();var rewardName:String = "<Enter_your_reward_name>"; App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.getRewardByName(rewardName,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var reward:Reward = Reward(response); trace("response is : " + reward); } }Coming SoonString rewardName = "<Enter_your_reward_name>"; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Reward reward = rewardService.getRewardByName(rewardName); System.out.println("rewardName is " + reward.getName()); System.out.println("rewardDescription is " + reward.getDescription()); String jsonResponse = reward.toString();
Add the reward points to an user account. Reward Points can be earned by the user which can be redeemed later.
Required Parameters
gameName - Name of the game for which reward points have to be added.
userName - The user for whom reward points have to be added.
rewardName - The rewards for which reward points have to be added.
rewardPoints - The points that have to be added.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; BigDecimal rewardPoints = new BigDecimal(3500); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.earnRewards(gameName , userName , rewardName , rewardPoints, new App42CallBack() { public void onSuccess(Object response) { Reward reward = (Reward)response; System.out.println("rewardName is " + reward.getName()); System.out.println("rewardgameName is " + reward.getGameName()); System.out.println("rewarduserName is " + reward.getUserName()); System.out.println("rewardpoints is " + reward.getPoints()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; double rewardPoints = 3500; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.EarnRewards(gameName,userName,rewardName,rewardPoints,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Reward reward = (Reward) response; Console.WriteLine("rewardName is" + reward.GetName()); Console.WriteLine("gameName is" + reward.GetGameName()); Console.WriteLine("points is" + reward.GetPoints()); } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; NSString *rewardName = @"<Enter_your_reward_name>"; double rewardPoints = 3500; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService earnRewards:gameName gameUserName:userName rewardName:rewardName rewardPoints:rewardPoints completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Reward *reward = (Reward*)responseObj; NSLog(@"rewardName is = %@" reward.name); NSLog(@"userName is = %@",reward.userName); NSLog(@"rewardDescription is = %@",reward.description); NSLog(@"points is = %@",reward.points); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let rewardName = "<Enter_your_reward_name>" let userName = "userName" let gameName = "<Enter_your_game_name>" let rewardPoint:Double = 1000 App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.earnRewards(gameName, gameUserName:userName, rewardName:rewardName, rewardPoints:rewardPoint, completionBlock: { (success, response, exception) -> Void in if(success) { let reward = response as! Reward NSLog("%@", reward.name) NSLog("%f", reward.points) NSLog("%@", reward.userName) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; BigDecimal rewardPoints = new BigDecimal(3500); App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Reward reward = rewardService.earnRewards(gameName,userName,rewardName,rewardPoints); System.out.println("rewardName is " + reward.getName()); System.out.println("rewardgameName is " + reward.getGameName()); System.out.println("rewarduserName is " + reward.getUserName()); System.out.println("rewardpoints is " + reward.getPoints()); System.out.println("points is" + reward.getPoints());String gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; double rewardPoints = 3500; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.EarnRewards(gameName, userName, rewardName, rewardPoints, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Reward reward = (Reward) response; App42Log.Console("rewardName is" + reward.GetName()); App42Log.Console("gameName is" + reward.GetGameName()); App42Log.Console("points is" + reward.GetPoints()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", var rewardName = "<Enter_your_reward_name>", userName = "Nick", rewardPoints = 3500, result ; App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.earnRewards(gameName,userName,rewardName,rewardPoints,{ success: function(object) { var rewardObj = JSON.parse(object); result = rewardObj.app42.response.rewards.reward; console.log("GameName : " + result.gameName) console.log("RewardName : " + result.name) console.log("Points : " + result.points) console.log("UserName : " + result.userName) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local rewardName = "<Enter_your_reward_name>" local userName = "Nick" local rewardPoints = 3500 local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:earnRewards(gameName,userName,rewardName,rewardPoints,App42CallBack) function App42CallBack:onSuccess(object) print("gameName is "..object:getGameName()) print("rewardName is "..object:getName()) print("points is "..object:getPoints()) print("userName is "..object:getUserName()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; const char* rewardName = "<Enter_your_reward_name>"; double rewardPoints = 100; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->EarnRewards(gameName, userName, rewardName, rewardPoints, app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; double rewardPoints = 3500; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); Reward reward = rewardService.EarnRewards(gameName,userName,rewardName,rewardPoints); Console.WriteLine("rewardName is" + reward.GetName()); Console.WriteLine("gameName is" + reward.GetGameName()); Console.WriteLine("points is" + reward.GetPoints());$gameName = "<Enter_your_game_name>"; $userName = "Nick"; $rewardName = "<Enter_your_reward_name>"; $rewardPoints = 3500; App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $reward = $rewardService->earnRewards($gameName,$userName,$rewardName,$rewardPoints); print_r("rewardName is" . $reward->getName()); print_r("gameName is" . $reward->getGameName()); print_r("points is" . $reward->getPoints()); print_r("UserName is".$reward->getUserName()); $jsonResponse = $reward->toString();const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; const char* rewardName = "<Enter_your_reward_name>"; double rewardPoints = 100; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->EarnRewards(gameName, userName, rewardName, rewardPoints, this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }game_name = "<Enter_your_game_name>"; game_user_name = "Nick"; reward_name = "<Enter_your_reward_name>"; reward_points = 1000; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") reward_service = api.build_reward_service reward = rewardService.earn_rewards(game_name, game_user_name, reward_name, reward_points); puts "rewardName is #{reward.name}"; puts "rewardgameName is #{reward.game_name}"; puts "rewarduserName is #{reward.user_name}"; puts "rewardpoints #{reward.points}"; json_response = reward.to_s();var gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; var rewardName:String = "<Enter_your_reward_name>"; var rewardPoints:Number = 100; App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.earnRewards(gameName,userName,rewardName,rewardPoints,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var reward:Reward = Reward(response); trace("rewardName is" + reward.getName()); trace("gameName is" + reward.getGameName()); trace("points is" + reward.getPoints()); } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; double rewardPoints = 3500; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Reward reward = rewardService.earnRewards(gameName,userName,rewardName,rewardPoints); System.out.println("rewardName is" + reward.getName()); System.out.println("gameName is" + reward.getGameName()); System.out.println("points is" + reward.getPoints());
Deducts the reward points from the earned rewards by an user.
Required Parameters
gameName - Name of the game for which reward points have to be deducted.
userName - The user for whom reward points have to be deducted.
rewardName - The rewards for which reward points have to be deducted.
rewardPoints - The points that have to be deducted.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; BigDecimal rewardPoints = new BigDecimal(3500); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.redeemRewards(gameName , userName , rewardName , rewardPoints, new App42CallBack() { public void onSuccess(Object response) { Reward reward = (Reward)response; System.out.println("rewardName is " + reward.getName()); System.out.println("rewardgameName is " + reward.getGameName()); System.out.println("rewarduserName is " + reward.getUserName()); System.out.println("rewardpoints is " + reward.getPoints()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; double rewardPoints = 3500; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.RedeemRewards(gameName,userName,rewardName,rewardPoints,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Reward reward = (Reward) response; Console.WriteLine("rewardName is" + reward.GetName()); Console.WriteLine("gameName is" + reward.GetGameName()); Console.WriteLine("points is" + reward.GetPoints()); } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; NSString *rewardName = @"<Enter_your_reward_name>"; double rewardPoints = 3500; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService redeemRewards:gameName gameUserName:userName rewardName:rewardName rewardPoints:rewardPoints completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Reward *reward = (Reward*)responseObj; NSLog(@"rewardName is = %@" reward.name); NSLog(@"userName is = %@",reward.userName); NSLog(@"rewardDescription is = %@",reward.description); NSLog(@"points is = %@",reward.points); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let rewardName = "<Enter_your_reward_name>" let userName = "userName" let gameName = "<Enter_your_reward_name>" let rewardPoint:Double = 2000 App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.redeemRewards(gameName, gameUserName:userName,rewardName:rewardName, rewardPoints:rewardPoint, completionBlock: { (success, response, exception) -> Void in if(success) { let reward = response as! Reward NSLog("%@", reward.name) NSLog("%f", reward.points) NSLog("%@", reward.userName) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; BigDecimal rewardPoints = new BigDecimal(3500); App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Reward reward = rewardService.redeemRewards(gameName,userName,rewardName,rewardPoints); System.out.println("rewardName is " + reward.getName()); System.out.println("rewardgameName is " + reward.getGameName()); System.out.println("rewarduserName is " + reward.getUserName()); System.out.println("rewardpoints is " + reward.getPoints()); System.out.println("points is" + reward.getPoints());String gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; double rewardPoints = 3500; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.RedeemRewards(gameName, userName, rewardName, rewardPoints, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Reward reward = (Reward) response; App42Log.Console("rewardName is" + reward.GetName()); App42Log.Console("gameName is" + reward.GetGameName()); App42Log.Console("points is" + reward.GetPoints()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "gameName", var rewardName = "<Enter_your_reward_name>", userName = "Nick", rewardPoints = 3500, result ; App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.redeemRewards(gameName,userName,rewardName,rewardPoints,{ success: function(object) { var rewardObj = JSON.parse(object); result = rewardObj.app42.response.rewards.reward; console.log("GameName : " + result.gameName) console.log("RewardName : " + result.name) console.log("Points : " + result.points) console.log("UserName : " + result.userName) }, error: function(error) { } });local gameName = "gameName" local rewardName = "<Enter_your_reward_name>" local userName = "Nick" local rewardPoints = 3500 local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:redeemRewards(gameName,userName,rewardName,rewardPoints,App42CallBack) function App42CallBack:onSuccess(object) print("gameName is "..object:getGameName()) print("rewardName is "..object:getName()) print("points is "..object:getPoints()) print("userName is "..object:getUserName()) end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; const char* rewardName = "<Enter_your_reward_name>"; double rewardPoints = 100; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->RedeemRewards(gameName, userName, rewardName, rewardPoints ,app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; double rewardPoints = 3500; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); Reward reward = rewardService.RedeemRewards(gameName,userName,rewardName,rewardPoints); Console.WriteLine("rewardName is" + reward.GetName()); Console.WriteLine("gameName is" + reward.GetGameName()); Console.WriteLine("points is" + reward.GetPoints());$gameName = "<Enter_your_game_name>"; $userName = "Nick"; $rewardName = "<Enter_your_reward_name>"; $rewardPoints = 3500; App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $reward = $rewardService->redeemRewards($gameName,$userName,$rewardName,$rewardPoints); print_r("rewardName is" . $reward->getName()); print_r("gameName is" . $reward->getGameName()); print_r("points is" . $reward->getPoints()); print_r("UserName is".$reward->getUserName()); $jsonResponse = $reward->toString();const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; const char* rewardName = "<Enter_your_reward_name>"; double rewardPoints = 100; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->RedeemRewards(gameName, userName, rewardName, rewardPoints , this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }game_name = "<Enter_your_game_name>"; game_user_name = "Nick"; reward_name = "<Enter_your_reward_name>"; reward_points = 1000; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") reward_service = api.build_reward_service reward = rewardService.redeem_rewards(game_name, game_user_name, reward_name, reward_points); puts "rewardName is #{reward.name}"; puts "rewardgameName is #{reward.game_name}"; puts "rewarduserName is #{reward.user_name}"; puts "rewardpoints #{reward.points}"; json_response = reward.to_s();var gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; var rewardName:String = "<Enter_your_reward_name>"; var rewardPoints:Number = 100; App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.redeemRewards(gameName,userName,rewardName,rewardPoints,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var reward:Reward = Reward(response); trace("rewardName is" + reward.getName()); trace("gameName is" + reward.getGameName()); trace("points is" + reward.getPoints()); } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; String rewardName = "<Enter_your_reward_name>"; double rewardPoints = 3500; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Reward reward = rewardService.redeemRewards(gameName,userName,rewardName,rewardPoints); System.out.println("rewardName is" + reward.getName()); System.out.println("gameName is" + reward.getGameName()); System.out.println("points is" + reward.getPoints());
Fetches the reward points for a particular user.
Required Parameters
gameName - Name of the game for which reward points have to be fetched.
userName - The user for whom reward points have to be fetched.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.getGameRewardPointsForUser(gameName , userName ,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Reward> reward = (ArrayList<Reward>)response; for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is : " + reward.get(i).getName()); System.out.println("gameName is : " + reward.get(i).getGameName()); System.out.println("point is : " + reward.get(i).getPoints()); System.out.println("userName : " + reward.get(i).getUserName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetGameRewardPointsForUser(gameName, userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Reward> reward = (List<Reward>)response; for(int i = 0;i < reward.Count;i++) { Console.WriteLine("rewardName is : " + reward[i].GetName()); Console.WriteLine("gameName is : " + reward[i].GetGameName()); Console.WriteLine("point is : " + reward[i].GetPoints()); Console.WriteLine("userName : " + reward[i].GetUserName()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService getGameRewardPointsForUser:gameName userName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *rewardList = (NSArray*)responseObj; for(Reward *reward in rewardList) { NSLog(@"rewardName is = %@" reward.name); NSLog(@"userName is = %@",reward.userName); NSLog(@"rewardDescription is = %@",reward.description); NSLog(@"points is = %@",reward.points); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "username" let gameName = "<Enter_your_game_name>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.getGameRewardPointsForUser(gameName, userName: userName, completionBlock: { (success, response, exception) -> Void in if(success) { let reward = response as! Reward NSLog("%@", reward.name) NSLog("%f", reward.points) NSLog("%@", reward.userName) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); ArrayList<Reward> reward = rewardService.getGameRewardPointsForUser(gameName, userName); for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is : " + reward.get(i).getName()); System.out.println("gameName is : " + reward.get(i).getGameName()); System.out.println("point is : " + reward.get(i).getPoints()); System.out.println("userName : " + reward.get(i).getUserName()); } String jsonResponse = reward.toString();String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetGameRewardPointsForUser(gameName, userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", userName = "Nick", result ; App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.getGameRewardPointsForUser(gameName, userName,{ success: function(object) { var rewardObj = JSON.parse(object); result = rewardObj.app42.response.rewards.reward; console.log("GameName : " + result.gameName) console.log("UserName : " + result.userName) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:getGameRewardPointsForUser(gameName,userName,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) > 1 then for i=1,table.getn(object) do print("gameName is "..object[i]:getGameName()) print("points is "..object[i]:getPoints()) print("userName is "..object[i]:getUserName()) end else print("gameName is "..object:getGameName()) print("rewardName is "..object:getName()) print("points is "..object:getPoints()) print("userName is "..object:getUserName()) end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetGameRewardPointsForUser(gameName,userName ,app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); Reward reward = rewardService.GetGameRewardPointsForUser(gameName, userName); Console.WriteLine("gameName is " + reward.GetGameName()); Console.WriteLine("userName is" + reward.GetUserName()); String jsonResponse = reward.ToString();$gameName = "<Enter_your_game_name>"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $rewardResponse = $rewardService->getGameRewardPointsForUser($gameName,$userName); foreach($rewardResponse as $reward) { print_r("UserName is ".$reward ->getUserName()); print_r("GameName is ".$reward ->getGameName()); print_r("Points ".$reward ->getPoints()); print_r("Reward is ".$reward ->getName()); } $jsonResponse = $rewardResponse[0]->toString();const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetGameRewardPointsForUser(gameName,userName , this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }game_name = "<Enter_your_game_name>"; user_name = "userName"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") reward_service = api.build_reward_service reward = reward_service.get_game_reward_points_for_user(game_name, user_name); puts "rewardName is #{reward.name}"; puts "rewardgameName is #{reward.game_name}"; puts "rewarduserName is #{reward.user_name}"; puts "rewardpoints #{reward.points}"; json_response = reward.to_s();var gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.getGameRewardPointsForUser(gameName,userName,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var rewards:Reward = Reward(response); trace("rewardName : " + rewards.getName()); trace("gameName : " + rewards.getGameName()); trace("userName : " + rewards.getUserName()); trace("points : " + rewards.getPoints()); } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Reward reward = rewardService.getGameRewardPointsForUser(gameName, userName); for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is : " + reward.get(i).getName()); System.out.println("gameName is : " + reward.get(i).getGameName()); System.out.println("point is : " + reward.get(i).getPoints()); System.out.println("userName : " + reward.get(i).getUserName()); }
This function provides a list of specified number of top reward earners for a specific game. Required Parameters
gameName - Name of the game for which reward earners are to be fetched.
rewardName - The user for whom reward points have to be fetched.
max - Specifies the number of top earners to be fetched.
String gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; int max = 10; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.getTopNRewardEarners(gameName, rewardName, max,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Reward> reward = (ArrayList<Reward>)response; for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is : " + reward.get(i).getName()); System.out.println("gameName is : " + reward.get(i).getGameName()); System.out.println("userName : " + reward.get(i).getUserName()); System.out.println("point is : " + reward.get(i).getPoints()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; int max = 10; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetTopNRewardEarners(gameName, rewardName, max,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Reward> reward = (List<Reward>) response; for(int i = 0;i < reward.Count;i++) { Console.WriteLine("rewardName is " + reward[i].GetName()); Console.WriteLine("gameName is" + reward[i].GetGameName()); Console.WriteLine("point is : " + reward[i].GetPoints()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *rewardName = @"<Enter_your_reward_name>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService getTopNRewardEarners:gameName rewardName:rewardName max:10 completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *rewardList = (NSArray*)responseObj; for(Reward *reward in rewardList) { NSLog(@"rewardName is = %@" reward.name); NSLog(@"userName is = %@",reward.userName); NSLog(@"rewardDescription is = %@",reward.description); NSLog(@"points is = %@",reward.points); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let rewardName = "<Enter_your_reward_name>" let gameName = "<Enter_your_game_name>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.getTopNRewardEarners(gameName, rewardName: rewardName, max:10, completionBlock: { (success, response, exception) -> Void in if(success) { let list = response as! NSArray for reward in list { NSLog("%@", reward.name) NSLog("%f", reward.points) NSLog("%@", reward.userName) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; int max = 10; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); ArrayList<Reward> reward = rewardService.getTopNRewardEarners(gameName, rewardName, max); for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is : " + reward.get(i).getName()); System.out.println("gameName is : " + reward.get(i).getGameName()); System.out.println("userName : " + reward.get(i).getUserName()); System.out.println("point is : " + reward.get(i).getPoints()); }String gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; int max = 10; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetTopNRewardEarners(gameName, rewardName, max, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Reward> reward = (List<Reward>) response; for(int i = 0;i < reward.Count;i++) { Console.WriteLine("rewardName is " + reward[i].GetName()); Console.WriteLine("gameName is" + reward[i].GetGameName()); Console.WriteLine("point is : " + reward[i].GetPoints()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", rewardName = "<Enter_your_reward_name>", max = 10, result ; App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.getTopNRewardEarners(gameName, rewardName, max, { success: function(object) { var rewardObj = JSON.parse(object); result = rewardObj.app42.response.rewards.reward; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("RewardName : " + result[i].name) console.log("GameName : " + result[i].gameName) console.log("Points : " + result[i].points) } } else { console.log("Reward Name is : " + result.name) console.log("GameName : " + result.gameName) console.log("Points : " + result.points) } }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local rewardName = "<Enter_your_reward_name>" local max = 10 local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:getTopNRewardEarners(gameName,rewardName,max,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) > 1 then for i=1,table.getn(object) do print("gameName is "..object[i]:getGameName()) print("points is "..object[i]:getPoints()) print("userName is "..object[i]:getUserName()) end else print("gameName is "..object:getGameName()) print("rewardName is "..object:getName()) print("points is "..object:getPoints()) print("userName is "..object:getUserName()) end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; int max = 5; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetTopNRewardEarners(gameName, rewardName, max,app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; int max = 10; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); IList<Reward> reward = rewardService.GetTopNRewardEarners(gameName, rewardName, max); for(int i = 0;i < reward.Count;i++) { Console.WriteLine("rewardName is " + reward[i].GetName()); Console.WriteLine("gameName is" + reward[i].GetGameName()); Console.WriteLine("point is : " + reward[i].GetPoints()); }$gameName = "<Enter_your_game_name>"; $rewardName = "<Enter_your_reward_name>"; $max = 10; App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $rewardResponse = $rewardService->getTopNRewardEarners($gameName, $rewardName, $max); foreach($rewardResponse as $reward) { print_r("UserName is ".$reward ->getUserName()); print_r("GameName is ".$reward ->getGameName()); print_r("Points ".$reward ->getPoints()); print_r("Reward is ".$reward ->getName()); } $jsonResponse = $rewardResponse[0]->toString();const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; int max = 5; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetTopNRewardEarners(gameName, rewardName, max, this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var rewardName:String = "<Enter_your_reward_name>"; var max:int = 10; App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.getTopNRewardEarners(gameName,rewardName,max,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { if(response is Array) { for(var i:int = 0;i < response.length;i++) { var rewards:Reward = Reward(response[i]); trace("rewardName : " + rewards.getName()); trace("gameName : " + rewards.getGameName()); trace("userName : " + rewards.getUserName()); trace("points : " + rewards.getPoints()); } } } }Coming SoonString gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; int max = 10; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Vector rewardList = rewardService.getTopNRewardEarners(gameName, rewardName, max); for(int i=0;i < rewardList.size();i++) { Reward reward = (Reward) rewardList.elementAt(i); System.out.println("rewardName is : " + reward.getName()); System.out.println("gameName is : " + reward.getGameName()); System.out.println("point is : " + reward.getPoints()); }
This function returns you a list of group wise users who earned the top rewards in the specified game. Required Parameters
gameName - Name of the game for which reward earners are to be fetched.
rewardName - The user for whom reward points have to be fetched.
userList - List of group wise users earning specified rewards.
String gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; ArrayList<String> userList = new ArrayList<String>(); userList.add("Nick"); userList.add("John"); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.getTopNRewardEarnersByGroup(gameName, rewardName, userList, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Reward> reward = (ArrayList<Reward>)response; for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is : " + reward.get(i).getName()); System.out.println("gameName is : " + reward.get(i).getGameName()); System.out.println("point is : " + reward.get(i).getPoints()); System.out.println("userName : " + reward.get(i).getUserName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; IList<String> userList = new List<String>(); userList.Add("Nick"); userList.Add("John"); App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetTopNRewardEarnersByGroup(gameName, rewardName, userList,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Reward> reward = (List<Reward>) response; for(int i = 0;i < reward.Count;i++) { Console.WriteLine("rewardName is " + reward[i].GetName()); Console.WriteLine("gameName is" + reward[i].GetGameName()); Console.WriteLine("point is : " + reward[i].GetPoints()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *rewardName = @"<Enter_your_reward_name>"; NSArray *usersList = [NSArray arrayWithObjects:@"Nick",@"John", nil]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService getTopNRewardEarnersByGroup:gameName rewardName:rewardName userList:usersList completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *rewardList = (NSArray*)responseObj; for(Reward *reward in rewardList) { NSLog(@"rewardName is = %@" reward.name); NSLog(@"userName is = %@",reward.userName); NSLog(@"rewardDescription is = %@",reward.description); NSLog(@"points is = %@",reward.points); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let rewardName = "<Enter_your_reward_name>" let gameName = "<Enter_your_game_name>" let userList = ["Nick","John"] App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.getTopNRewardEarnersByGroup(gameName, rewardName: rewardName, userList:userList, completionBlock: { (success, response, exception) -> Void in if(success) { let list = response as! NSArray for reward in list { NSLog("%@", reward.name) NSLog("%f", reward.points) NSLog("%@", reward.userName) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); ArrayList<String> userList = new ArrayList<String>(); userList.add("Nick"); userList.add("John"); ArrayList<Reward> getTopRanker = rewardService.getTopNRewardEarnersByGroup(gameName, rewardName, userList); for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is : " + reward.get(i).getName()); System.out.println("gameName is : " + reward.get(i).getGameName()); System.out.println("point is : " + reward.get(i).getPoints()); System.out.println("userName : " + reward.get(i).getUserName()); }String gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; IList<String> userList = new List<String>(); userList.Add("Nick"); userList.Add("John"); App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetTopNRewardEarnersByGroup(gameName, rewardName, userList, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Reward> reward = (List<Reward>) response; for(int i = 0;i < reward.Count;i++) { App42Log.Console("rewardName is " + reward[i].GetName()); App42Log.Console("gameName is" + reward[i].GetGameName()); App42Log.Console("point is : " + reward[i].GetPoints()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", rewardName = "<Enter_your_reward_name>"; var userList = new Array(); userList.push("Nick") userList.push("John") App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.getTopNRewardEarnersByGroup(gameName, rewardName, userList,{ success: function(object) { var rewardObj = JSON.parse(object); result = rewardObj.app42.response.rewards.reward; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("RewardName : " + result[i].name) console.log("GameName : " + result[i].gameName) console.log("Points : " + result[i].points) } } else { console.log("Reward Name is : " + result.name) console.log("GameName : " + result.gameName) console.log("Points : " + result.points) } }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local rewardName = "<Enter_your_reward_name>" local userList = {} userList[1] = "Nick" userList[2] = "John" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:getTopNRewardEarnersByGroup(gameName,rewardName,userList,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) > 1 then for i=1,table.getn(object) do print("gameName is "..object[i]:getGameName()) print("points is "..object[i]:getPoints()) print("userName is "..object[i]:getUserName()) end else print("gameName is "..object:getGameName()) print("rewardName is "..object:getName()) print("points is "..object:getPoints()) print("userName is "..object:getUserName()) end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; std::vector<std::string>userList; userList.push_back(userName); App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetTopNRewardEarnersByGroup(gameName, rewardName, userList, app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; IList<String> userList = new List<String>(); userList.Add("Nick"); userList.Add("John"); App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); IList<Reward> reward = rewardService.GetTopNRewardEarnersByGroup(gameName, rewardName, userList); for(int i = 0;i < reward.Count;i++) { Console.WriteLine("rewardName is " + reward[i].GetName()); Console.WriteLine("gameName is" + reward[i].GetGameName()); Console.WriteLine("point is : " + reward[i].GetPoints()); }$gameName = "<Enter_your_game_name>"; $rewardName = "<Enter_your_reward_name>"; $userList = array(); array_push($userList, "Nick"); array_push($userList, "John"); App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $rewardResponse = $rewardService->getTopNRewardEarnersByGroup($gameName, $rewardName, $userList); foreach ($rewardResponse as $reward) { print_r("UserName is ".$reward->getUserName()); print_r("GameName is ".$reward->getGameName()); print_r("Points ".$reward->getPoints()); print_r("Reward is ".$reward->getName()); } $jsonResponse = $rewardResponse[0]->toString();const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; std::vector<std::string>userList; userList.push_back(userName); App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetTopNRewardEarnersByGroup(gameName, rewardName, userList, this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var rewardName:String = "<Enter_your_reward_name>"; var userList:Array = []; userList.push("Nick"); userList.push("John"); App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.getTopNRewardEarnersByGroup(gameName,rewardName,userList:Array,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception : " + excption); } public function onSuccess(response:Object):void { if(response is Array) { for(var i:int = 0;i < response.length;i++) { var rewards:Reward = Reward(response[i]); trace("rewardName : " + rewards.getName()); trace("gameName : " + rewards.getGameName()); trace("userName : " + rewards.getUserName()); trace("points : " + rewards.getPoints()); } } } }Coming SoonString gameName = "<Enter_your_game_name>"; String rewardName = "<Enter_your_reward_name>"; Vector userList = new Vector(); userList.addElement("Nick"); userList.addElement("John"); App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Vector rewardList = rewardService.getTopNRewardEarnersByGroup(gameName, rewardName, userList); for(int i=0;i < rewardList.size();i++) { Reward reward = (Reward) rewardList.elementAt(i); System.out.println("rewardName is : " + reward.getName()); System.out.println("gameName is : " + reward.getGameName()); System.out.println("point is : " + reward.getPoints()); }
This function returns you the details of all the specific rewards earned by the specified user.
Required Parameters
userName - Name of the user whose rewards are to be fetched.
rewardName - Name of the reward for which details are to be fetched.
String rewardName = "<Enter_your_reward_name>"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); rewardService.getAllRewardsByUser(userName, rewardName, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Reward> reward = (ArrayList<Reward>)response; for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is : " + reward.get(i).getName()); System.out.println("gameName is : " + reward.get(i).getGameName()); System.out.println("point is : " + reward.get(i).getPoints()); System.out.println("userName : " + reward.get(i).getUserName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String rewardName = "<Enter_your_reward_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetAllRewardsByUser(userName,rewardName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Reward> reward = (List<Reward>) response; for(int i = 0;i < reward.size();i++) { Console.WriteLine("rewardName is " + reward[i].GetName()); Console.WriteLine("rewardDescription is " + reward[i].GetDescription()); } } }NSString *rewardName = @"<Enter_your_reward_name>"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; RewardService *rewardService = [App42API buildRewardService]; [rewardService getAllRewardsByUser:userName rewardName:rewardName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *rewardList = (NSArray*)responseObj; for(Reward *reward in rewardList) { NSLog(@"rewardName is = %@" reward.name); NSLog(@"rewardDescription is = %@",reward.description); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let rewardName = "<Enter_your_reward_name>" let userName = "username" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let rewardService = App42API.buildRewardService() as? RewardService rewardService?.getAllRewardsByUser(userName, rewardName: rewardName, completionBlock: { (success, response, exception) -> Void in if(success) { let list = response as! NSArray for reward in list { NSLog("%@", reward.name) NSLog("%f", reward.points) NSLog("%@", reward.userName) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String rewardName = "<Enter_your_reward_name>"; String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); rewardService.GetAllRewardsByUser(userName,rewardName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Reward> reward = (List<Reward>) response; for(int i = 0;i < reward.Count;i++) { App42Log.Console("rewardName is " + reward[i].GetName()); App42Log.Console("gameName is" + reward[i].GetGameName()); App42Log.Console("point is : " + reward[i].GetPoints()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var rewardName = "<Enter_your_reward_name>", userName = "Nick", result ; App42.initialize("API_KEY","SECRET_KEY"); var rewardService = new App42Reward(); rewardService.getAllRewardsByUser(userName,rewardName,{ success: function(object) { var rewardObj = JSON.parse(object); result = rewardObj.app42.response.rewards.reward; if (result instanceof Array) { for(var i = 0;i<result.length;i++) { console.log("RewardName : " + result[i].name) console.log("GameName : " + result[i].gameName) console.log("Points : " + result[i].points) } } else { console.log("Reward Name is : " + result.name) console.log("GameName : " + result.gameName) console.log("Points : " + result.points) } }, error: function(error) { } });local userName = "Nick" local rewardName = "<Enter_your_reward_name>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local rewardService = App42API:buildRewardService() rewardService:getAllRewardsByUser(userName,rewardName,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) > 1 then for i=1,table.getn(object) do print("gameName is "..object[i]:getGameName()) print("points is "..object[i]:getPoints()) print("userName is "..object[i]:getUserName()) end else print("gameName is "..object:getGameName()) print("rewardName is "..object:getName()) print("points is "..object:getPoints()) print("userName is "..object:getUserName()) end end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetAllRewardsByUser(userName, rewardName,app42callback(Sample_Class::onRewardRequestCompleted, this)); void Sample_Class::onRewardRequestCompleted(void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }String rewardName = "<Enter_your_reward_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.BuildRewardService(); IList<Reward> reward = rewardService.GetAllRewardsByUser(userName,rewardName); for(int i = 0;i < reward.Count;i++) { Console.WriteLine("rewardName is " + reward[i].GetName()); Console.WriteLine("gameName is" + reward[i].GetGameName()); Console.WriteLine("point is : " + reward[i].GetPoints()); }$rewardName = "<Enter_your_reward_name>"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $rewardService = App42API::buildRewardService(); $rewardResponse = $rewardService->getAllRewardsByUser($userName,$rewardName); foreach ($rewardResponse as $reward) { print_r("UserName is " . $reward->getUserName()); print_r("GameName is " . $reward->getGameName()); print_r("Points " . $reward->getPoints()); print_r("Reward is " . $reward->getName()); } $jsonResponse = $rewardResponse[0]->toString();const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; App42API:Initialize("API_KEY","SECRET_KEY") RewardService *rewardService = App42API::BuildRewardService(); rewardService->GetAllRewardsByUser(userName, rewardName, this, app42callfuncND_selector(Sample_Class::onRewardRequestCompleted)); void Sample_Class::onRewardRequestCompleted(App42CallBack *sender, void *response) { App42RewardResponse *rewardResponse = (App42RewardResponse*)response; printf("\ncode=%d",rewardResponse->getCode()); printf("\nResponse Body=%s",rewardResponse->getBody().c_str()); if (rewardResponse->isSuccess) { for(std::vector<App42Reward>::iterator it = rewardResponse->rewards.begin(); it != rewardResponse->rewards.end(); ++it) { printf("\nReward Name=%s",it->name.c_str()); printf("\nGame Name=%s",it->gameName.c_str()); printf("\nUser Name=%s",it->userName.c_str()); printf("\nRewards Point=%lf",it->points); } } else { printf("\nerrordetails:%s",rewardResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",rewardResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",rewardResponse->appErrorCode); printf("\nhttpErrorCode:%d",rewardResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; App42API.initialize("API_KEY","SECRET_KEY"); var rewardService:RewardService = App42API.buildRewardService(); rewardService.getAllRewardsByUser(gameName,userName,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { if(response is Array) { for(var i:int = 0;i < response.length;i++) { var rewards:Reward = Reward(response[i]); trace("rewardName : " + rewards.getName()); trace("gameName : " + rewards.getGameName()); trace("userName : " + rewards.getUserName()); trace("points : " + rewards.getPoints()); } } } }Coming SoonString rewardName = "<Enter_your_reward_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); Vector reward = rewardService.getAllRewardsByUser(userName,rewardName); for(int i=0;i < rewardList.size();i++) { Reward reward = (Reward) rewardList.elementAt(i); System.out.println("rewardName is : " + reward.getName()); System.out.println("gameName is : " + reward.getGameName()); System.out.println("point is : " + reward.getPoints()); }String rewardName = "<Enter_your_reward_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); RewardService rewardService = App42API.buildRewardService(); ArrayList<Reward> reward = rewardService.getAllRewardsByUser(userName,rewardName); for(int i = 0;i < reward.size();i++) { System.out.println("rewardName is : " + reward.get(i).getName()); System.out.println("gameName is : " + reward.get(i).getGameName()); System.out.println("point is : " + reward.get(i).getPoints()); System.out.println("userName : " + reward.get(i).getUserName()); }