Comprehensive Leaderboard Management service provides operations like top ranking, social ranking, top ranking within Buddy list, location based leaderboard, etc. out of the box. This service allows Game, User, Score and Scoreboard management on the Cloud. Developers can create games and then maintain the game scoring using the Score service and Scoreboard is maintained across game sessions. Developers also can query for average or highest score for users for a Game or highest and average score across users for a Game. It also records and provides ranking of any user against other users for a particular game. The Reward and Reward Points allow the developers to assign rewards to a user and redeem them. All these services Game, Score, ScoreBoard, Reward, and Reward Points can be used in conjunction to develop a Game Center like feature. The Leaderboard Service is highly scalable and can manage scores in millions.
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.Game; import com.shephertz.app42.paas.sdk.android.game.GameService; import com.shephertz.app42.paas.sdk.android.game.Reward; import com.shephertz.app42.paas.sdk.android.game.RewardService; import com.shephertz.app42.paas.sdk.android.game.ScoreBoardService; import com.shephertz.app42.paas.sdk.android.game.ScoreService;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.Game; import com.shephertz.app42.paas.sdk.java.game.GameService; import com.shephertz.app42.paas.sdk.java.game.Reward; import com.shephertz.app42.paas.sdk.java.game.RewardService; import com.shephertz.app42.paas.sdk.java.game.ScoreBoardService; import com.shephertz.app42.paas.sdk.java.game.ScoreService;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 '../GameService.php'; include_once '../RewardService.php'; include_once '../ScoreBoardService.php'; include_once '../ScoreService.php'; include_once '../App42Log.php'; include_once '../App42Exception.php'; include_once '../App42NotFoundException.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.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.Game; import com.shephertz.app42.paas.sdk.as3.game.GameService; import com.shephertz.app42.paas.sdk.as3.game.Reward; import com.shephertz.app42.paas.sdk.as3.game.RewardService; import com.shephertz.app42.paas.sdk.as3.game.ScoreBoardService; import com.shephertz.app42.paas.sdk.as3.game.ScoreService;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.Game; import com.shephertz.app42.paas.sdk.jme.game.GameService; import com.shephertz.app42.paas.sdk.jme.game.Reward; import com.shephertz.app42.paas.sdk.jme.game.RewardService; import com.shephertz.app42.paas.sdk.jme.game.ScoreBoardService; import com.shephertz.app42.paas.sdk.jme.game.ScoreService;
In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available 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, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of GameService, buildGameService() method needs to be called.
GameService gameService = App42API.buildGameService(); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService();GameService gameService = App42API.BuildGameService(); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService();GameService *gameService = [App42API buildGameService]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService];var gameService = App42API.buildGameService() as? GameService var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardServiceGameService gameService = App42API.buildGameService(); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService();GameService gameService = App42API.BuildGameService(); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService();var gameService = new App42Game(); var scoreBoardService = new App42ScoreBoard();local gameService = App42API.buildGameService() local scoreBoardService = App42API.buildScoreBoardService()GameService *gameService = App42API::BuildGameService(); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService();GameService gameService = App42API.BuildGameService(); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService();$gameService = App42API::buildGameService(); $scoreBoardService = App42API::buildScoreBoardService();GameService *gameService = App42API::BuildGameService(); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService();game_service = api.build_game_service score_board_service = api.build_score_board_servicevar gameService:GameService = App42API.buildGameService(); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService();Coming SoonGameService gameService = App42API.buildGameService(); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService();
Create game on the cloud.
Required Parameters
gameName - The name of the game that has to be created.
description - Description of the game to be created.
String gameName = "<Enter_your_game_name>"; String description = "description"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); gameService.createGame(gameName, description, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("gameName is " + game.getName()); System.out.println("gameDescription is " + game.getDescription()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; public class Callback : App42Callback { String description = "description"; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.CreateGame(gameName,description,new Callback()); public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); Console.WriteLine("gameDescription is " + game.GetDescription()); } }NSString *gameName = @"<Enter_your_game_name>"; NSString *description = @"description"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GameService *gameService = [App42API buildGameService]; [gameService createGame:gameName gameDescription:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSLog(@"gameDescription is = %@",game.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 gameName = "<Enter_your_game_name>" let description = "Enter_your_game_description" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var gameService = App42API.buildGameService() as? GameService gameService?.createGame(gameName, gameDescription: description, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("Game Name = %@", game.name) NSLog("Description = %@", game.description) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; String description = "description"; App42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); Game game = gameService.createGame(gameName,description); System.out.println("gameName is " + game.getName()); System.out.println("gameDescription is " + game.getDescription());String gameName = "<Enter_your_game_name>"; String description = "description"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.CreateGame(gameName, description, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); App42Log.Console("gameDescription is " + game.GetDescription()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", description = "description", result ; App42.initialize("API_KEY","SECRET_KEY"); var gameService = new App42Game(); gameService.createGame(gameName,description,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is " + result.name) console.log("gameDescription is " + result.description) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local description = "description" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local gameService = App42API.buildGameService() gameService:createGame(gameName,description,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("Description 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* gameName = "<Enter_your_game_name>"; const char* description = "Description"; App42API::Initialize("API_KEY", "SECRET_KEY"); GameService *gameService = App42API::BuildGameService(); gameService->CreateGame(gameName, description, app42callback(Sample_Class::onGameRequestCompleted, this)); void Sample_Class::onGameRequestCompleted(void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { for(std::vector<App42Game>::iterator it = gameResponse->games.begin(); it != gameResponse->games.end(); ++it) { printf("\n Game Name=%s",it->name.c_str()); printf("\n Description=%s\n",it->description.c_str()); } } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String description = "description"; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); Game game = gameService.CreateGame(gameName,description); Console.WriteLine("gameName is " + game.GetName()); Console.WriteLine("gameDescription is " + game.GetDescription());$gameName = "<Enter_your_game_name>"; $description = "description"; App42API::initialize("API_KEY","SECRET_KEY"); $gameService = App42API::buildGameService(); $game = $gameService->createGame($gameName,$description); print_r("gameName is " . $game->getName()); print_r("gameDescription is " . $game->getDescription()); $jsonResponse = $game->toString();const char* gameName = "<Enter_your_game_name>"; const char* description = "Description"; App42API::Initialize("API_KEY", "SECRET_KEY"); GameService *gameService = App42API::BuildGameService(); gameService->CreateGame(gameName, description, this, app42callfuncND_selector(Sample_Class::onGameRequestCompleted)); void Sample_Class::onGameRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { for(std::vector<App42Game>::iterator it = gameResponse->games.begin(); it != gameResponse->games.end(); ++it) { printf("\n Game Name=%s",it->name.c_str()); printf("\n Description=%s\n",it->description.c_str()); } } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); } }gameName = "<Enter_your_game_name>"; description = "description"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") game_service = api.build_game_service game = game_service.create_game(gameName,description); puts "gameName is #{game.name}"; puts "gameDescription is #{game.description}";var gameName:String = "<Enter_your_game_name>"; var description:String = "description"; App42API.initialize("API_KEY","SECRET_KEY"); var gameService:GameService = App42API.buildGameService(); gameService.createGame(gameName,description, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(response); trace("gameName is : " + game.getName()); trace("gameDescription is : " + game.getDescription()); } }Coming SoonString gameName = "<Enter_your_game_name>"; String description = "description"; App42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); Game game = gameService.createGame(gameName,description); System.out.println("gameName is " + game.getName()); System.out.println("gameDescription is " + game.getDescription());
Fetche all games for the App.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); gameService.getAllGames(new App42CallBack() { public void onSuccess(Object response) { ArrayList<Game> game = (ArrayList<Game>)response; for(int i=0;i<game.size();i++) { System.out.println("gameName is " + game.get(i).getName()); System.out.println("description is " + game.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.GetAllGames(new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception : " + exception); } public void OnSuccess(Object response) { IList<Game> game = (List<Game>) response; for (int i = 0; i < game.Count; i++) { Console.WriteLine("gameName is " + game[i].GetName()); Console.WriteLine("gameDescription is " + game[i].GetDescription()); } } }[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GameService *gameService = [App42API buildGameService]; [gameService getAllGames:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *gameList = (NSArray*)responseObj; for(Game *game in gameList) { NSLog(@"Game Name is = %@",game.name); NSLog(@"Game Description is = %@",game.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") var gameService = App42API.buildGameService() as? GameService gameService?.getAllGames({ (success, response, exception) -> Void in if(success) { var gameList = response as NSArray for game in games { NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })App42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); ArrayList<Game> game = gameService.getAllGames(); for(int i=0;i<game.size();i++) { System.out.println("gameName is " + game.get(i).getName()); System.out.println("description is " + game.get(i).getDescription()); }App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.GetAllGames(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Game> game = (List<Game>) response; for (int i = 0; i < game.Count; i++) { App42Log.Console("gameName is " + game[i].GetName()); App42Log.Console("gameDescription is " + game[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result ; App42.initialize("API_KEY","SECRET_KEY"); var gameService = new App42Game(); gameService.getAllGames({ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("result is " + result) }, error: function(error) { } });local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local gameService = App42API.buildGameService() gameService:getAllGames(App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) > 1 then for i=1,table.getn(object) do print("Game name is "..object[i]:getName()) print("Description is "..object[i]:getDescription()) end else print("Game name is "..object:getName()) print("Description 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"); GameService *gameService = App42API::BuildGameService(); gameService->GetAllGames(app42callback(Sample_Class::onGameRequestCompleted, this)); void Sample_Class::onGameRequestCompleted(void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { for(std::vector<App42Game>::iterator it = gameResponse->games.begin(); it != gameResponse->games.end(); ++it) { printf("\n Game Name=%s",it->name.c_str()); printf("\n Description=%s\n",it->description.c_str()); } } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); } }App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); IList<Game> game = gameService.GetAllGames(); for (int i = 0; i < game.Count; i++) { Console.WriteLine("gameName is " + game[i].GetName()); Console.WriteLine("gameDescription is " + game[i].GetDescription()); }App42API::initialize("API_KEY","SECRET_KEY"); $gameService = App42API::buildGameService(); $gameList = $gameService->getAllGames(); foreach ($gameList as $game) { print_r("gameName is" . $game->getName()); print_r("gameDescription is" . $game->getDescription()); } $jsonResponse = $gameList[0]->toString();App42API::Initialize("API_KEY", "SECRET_KEY"); GameService *gameService = App42API::BuildGameService(); gameService->GetAllGames(this, app42callfuncND_selector(Sample_Class::onGameRequestCompleted)); void Sample_Class::onGameRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { for(std::vector<App42Game>::iterator it = gameResponse->games.begin(); it != gameResponse->games.end(); ++it) { printf("\n Game Name=%s",it->name.c_str()); printf("\n Description=%s\n",it->description.c_str()); } } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); } }game_list = Array.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") game_service = api.build_game_service game = game_service.get_all_games(); for game in game_list do puts "gameName is #{game.name}"; puts "gameDescription is #{game.description}"; end json_response = game_list.to_s();App42API.initialize("API_KEY","SECRET_KEY"); var gameService:GameService = App42API.buildGameService(); gameService.getAllGames(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 game:Game = Game(response[i]); trace("gameName is " + game.getName()); trace("description : " + game.getDescription()); } } } }Coming SoonApp42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); Vector gameList = gameService.getAllGames(); for(int i=0;i< gameList.size();i++) { Game game = (Game) gameList.elementAt(i); System.out.println("gameName is " + game.getName()); System.out.println("gameDescription is " + game.getDescription()); }
Get the count of all the games.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); gameService.getAllGamesCount(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"); GameService gameService = App42API.BuildGameService(); gameService.GetAllGamesCount(new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception : "+ exception); } public void OnSuccess(Object response) { App42Response response = (App42Response) response; String jsonResponse = response.ToString(); } }[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GameService *gameService = [App42API buildGameService]; [gameService getAllGamesCount:^(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") var gameService = App42API.buildGameService() as? GameService gameService?.getAllGamesCount({ (success, response, exception) -> Void in if(success) { var app42Response = response as App42Response NSLog("Response success is : %@", app42Response.strResponse) NSLog("Total Games Count is %d", app42Response.totalRecords) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })App42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); App42Response app42response = gameService.getAllGamesCount(); boolean success = app42response.isResponseSuccess(); System.out.println("Total Records : " + app42response.getTotalRecords()) ; String jsonResponse = app42response.toString();App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.GetAllGamesCount(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response response = (App42Response) response; String jsonResponse = response.ToString(); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result ; App42.initialize("API_KEY","SECRET_KEY"); var gameService = new App42Game(); gameService.getAllGamesCount({ success: function(object) { var game = JSON.parse(object); result = game.app42.response; console.log("totalRecords : " + result.totalRecords) }, error: function(error) { } });local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local gameService = App42API.buildGameService() gameService:getAllGamesCount(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"); GameService *gameService = App42API::BuildGameService(); gameService->GetAllGamesCount(app42callback(Sample_Class::onGameRequestCompleted, this)); void Sample_Class::onGameRequestCompleted(void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { printf("\nTotalRecords=%d",gameResponse->getTotalRecords()); } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); } }App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); App42Response response = gameService.GetAllGamesCount(); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();App42API::initialize("API_KEY","SECRET_KEY"); $gameService = App42API::buildGameService(); $response = $gameService->getAllGamesCount(); print_r("Total Records : ".$response->getTotalRecords()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();App42API::Initialize("API_KEY", "SECRET_KEY"); GameService *gameService = App42API::BuildGameService(); gameService->GetAllGamesCount(this, app42callfuncND_selector(Sample_Class::onGameRequestCompleted)); void Sample_Class::onGameRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { printf("\nTotalRecords=%d",gameResponse->getTotalRecords()); } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); } }api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") game_service = api.build_game_service response = game_service.get_all_games_count(); success = response.is_response_success(); total_records = response.total_records(); json_response = response.to_s();App42API.initialize("API_KEY","SECRET_KEY"); var gameService:GameService = App42API.buildGameService(); gameService.getAllGamesCount(new callback() ); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var app42response:App42Response = App42Response(response); trace("app42response is : " + app42response); } }Coming SoonApp42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); App42Response response = gameService.getAllGamesCount(); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Fetche all games for the App by Paging.
Required Parameters
max - Maximum number of records to be fetched.
offset - From where the records are to be fetched
int max = 10; int offset = 0 ; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); gameService.getAllGames(max, offset, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Game> game = (ArrayList<Game>)response; for(int i=0;i<game.size();i++) { System.out.println("gameName is " + game.get(i).getName()); System.out.println("description is " + game.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });int max = 10; int offset = 0 ; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.GetAllGames(max,offset,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Game> game = (List<Game>) response; for (int i = 0; i < game.Count; i++) { Console.WriteLine("gameName is " + game[i].GetName()); Console.WriteLine("gameDescription is " + game[i].GetDescription()); } } }int max = 10; int offset = 0 ; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GameService *gameService = [App42API buildGameService]; [gameService getAllGames:max offset:offset completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *gameList = (NSArray*)responseObj; for(Game *game in gameList) { NSLog(@"Game Name is = %@",game.name); NSLog(@"Game Description is = %@",game.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 = 5 let offset:Int32 = 0 App42API.initializeWithAPIKey("API_KEY" andSecretKey: "SECRET_KEY") var gameService = App42API.buildGameService() as? GameService gameService?.getAllGames(max, offset: offset, completionBlock: { (success, response, exception) -> Void in if(success) { let games = response as! NSArray for game in games { NSLog("Game Name = %@", game.name) NSLog("Description = %@", game.description) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })int max = 10; int offset = 0 ; App42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); ArrayList<Game> game = gameService.getAllGames(max,offset); for(int i=0;i<game.size();i++) { System.out.println("gameName is " + game.get(i).getName()); System.out.println("description is " + game.get(i).getDescription()); }int max = 10; int offset = 0 ; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.GetAllGames(max, offset, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Game> game = (List<Game>) response; for (int i = 0; i < game.Count; i++) { App42Log.Console("gameName is " + game[i].GetName()); App42Log.Console("gameDescription is " + game[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var max = 10, offset = 0 , result ; App42.initialize("API_KEY","SECRET_KEY"); var gameService = new App42Game(); gameService.getAllGamesWithPaging(max,offset,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("result is " + result) }, error: function(error) { } });local max = 5 local offset = 0 local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local gameService = App42API.buildGameService() gameService:getAllGamesWithPaging(max,offset,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object) > 1 then for i=1,table.getn(object) do print("Game name is "..object[i]:getName()) print("Description is "..object[i]:getDescription()) end else print("Game name is "..object:getName()) print("Description 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 = 2; int offset = 0; App42API::Initialize("API_KEY", "SECRET_KEY"); GameService *gameService = App42API::BuildGameService(); gameService->GetAllGames(max,offset,app42callback(Sample_Class::onGameRequestCompleted, this)); void Sample_Class::onGameRequestCompleted(void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { for(std::vector<App42Game>::iterator it = gameResponse->games.begin(); it != gameResponse->games.end(); ++it) { printf("\n Game Name=%s",it->name.c_str()); printf("\n Description=%s\n",it->description.c_str()); } } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); } }int max = 10; int offset = 0 ; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); IList<Game> game = gameService.GetAllGames(max,offset); for (int i = 0; i < game.Count; i++) { Console.WriteLine("gameName is " + game[i].GetName()); Console.WriteLine("gameDescription is " + game[i].GetDescription()); }$max = 10; $offset = 0 ; App42API::initialize("API_KEY","SECRET_KEY"); $gameService = App42API::buildGameService(); $gameList = $gameService->getAllGames($max,$offset); foreach ($gameList as $game) { print_r("gameName is" . $game->getName()); print_r("gameDescription is" . $game->getDescription()); } $jsonResponse = $gameList[0]->toString();int max = 2; int offset = 0; App42API::Initialize("API_KEY", "SECRET_KEY"); GameService *gameService = App42API::BuildGameService(); gameService->GetAllGames(max,offset,this, app42callfuncND_selector(Sample_Class::onGameRequestCompleted)); void Sample_Class::onGameRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { for(std::vector<App42Game>::iterator it = gameResponse->games.begin(); it != gameResponse->games.end(); ++it) { printf("\n Game Name=%s",it->name.c_str()); printf("\n Description=%s\n",it->description.c_str()); } } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); } }max = 10; offset = 0; game_list = Array.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") game_service = api.build_game_service game= game_service.get_all_games_by_paging(max,offset); for game in game_list do puts "gameName is #{game.name}"; puts "gameDescription is #{game.description}"; end json_response = game_list.to_s();var max:int = 1; var offset:int = 0; App42API.initialize("API_KEY","SECRET_KEY"); var gameService:GameService = App42API.buildGameService(); gameService.getAllGamesByPaging(max,offset, 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 game:Game = Game(response[i]); trace("gameName is " + game.getName()); trace("gameDescription : " + game.getDescription()); } } } }Coming SoonInteger max = new Integer(1); Integer offset = new Integer(0); App42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); Vector gameList = gameService.getAllGames(max,offset); for(int i=0;i< gameList.size();i++) { Game game = (Game) gameList.elementAt(i); System.out.println("gameName is " + game.getName()); System.out.println("gameDescription is " + game.getDescription()); }
Fetch the game by the specified name.
Required Parameters
gameName - Name of the game that has to be fetched
String gameName = "<Enter_your_game_name>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); gameService.getGameByName(gameName, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("gameName is " + game.getName()); System.out.println("gameDescription is " + game.getDescription()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.GetGameByName(gameName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); Console.WriteLine("gameDescription is " + game.GetDescription()); } }NSString *gameName = @"<Enter_your_game_name>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GameService *gameService = [App42API buildGameService]; [gameService getGameByName:gameName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSLog(@"gameDescription is = %@",game.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]); } }];var gameName = "<Enter_your_game_name>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var gameService = App42API.buildGameService() as? GameService gameService?.getGameByName(gameName, { completionBlock:{ (success, response, exception) -> Void in if(success) { var game = response as! Game NSLog("Game Name = %@", game.name) NSLog("Description = %@", game.description) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; App42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); Game game = gameService.getGameByName(gameName); System.out.println("gameName is " + game.getName()); System.out.println("gameDescription is " + game.getDescription());String gameName = "<Enter_your_game_name>"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.GetGameByName(gameName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); App42Log.Console("gameDescription is " + game.GetDescription()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", result ; App42.initialize("API_KEY","SECRET_KEY"); var gameService = new App42Game(); gameService.getGameByName(gameName,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is " + result.name) console.log("gameDescription is " + result.description) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local gameService = App42API.buildGameService() gameService:getGameByName(gameName,App42CallBack) gameService:getGameByName(gameName,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("Description 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* gameName = "<Enter_your_game_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); GameService *gameService = App42API::BuildGameService(); gameService->GetGamebyName(gameName,app42callback(Sample_Class::onGameRequestCompleted, this)); void Sample_Class::onGameRequestCompleted(void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { for(std::vector<App42Game>::iterator it = gameResponse->games.begin(); it != gameResponse->games.end(); ++it) { printf("\n Game Name=%s",it->name.c_str()); printf("\n Description=%s\n",it->description.c_str()); } } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); Game game = gameService.GetGameByName(gameName); Console.WriteLine("gameName is " + game.GetName()); Console.WriteLine("gameDescription is " + game.GetDescription());$gameName = "<Enter_your_game_name>"; App42API::initialize("API_KEY","SECRET_KEY"); $gameService = App42API::buildGameService(); $game = $gameService->getGameByName($gameName); print_r("gameName is " . $game->getName()); print_r("gameDescription is " . $game->getDescription()); $jsonResponse = $game->toString();const char* gameName = "<Enter_your_game_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); GameService *gameService = App42API::BuildGameService(); gameService->GetGamebyName(gameName, this, app42callfuncND_selector(Sample_Class::onGameRequestCompleted)); void Sample_Class::onGameRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { for(std::vector<App42Game>::iterator it = gameResponse->games.begin(); it != gameResponse->games.end(); ++it) { printf("\n Game Name=%s",it->name.c_str()); printf("\n Description=%s\n",it->description.c_str()); } } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); } }gameName = "<Enter_your_game_name>"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") game_service = api.build_game_service game = game_service.get_game_by_name(gameName); puts "gameName is #{game.name}"; puts "gameDescription is #{game.description}";var gameName:String = "<Enter_your_game_name>"; App42API.initialize("API_KEY","SECRET_KEY"); var gameService:GameService = App42API.buildGameService(); gameService.getGameByName(gameName, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(response); trace("gameName is " + game.getName()); trace("gameDescription is " + game.getDescription()); } }Coming SoonString gameName = "<Enter_your_game_name>"; App42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); Game game = gameService.getGameByName(gameName); System.out.println("gameName is " + game.getName()); System.out.println("gameDescription is " + game.getDescription());
Save the User score for a game.
Required Parameters
gameName - Name of the game for which score has to be saved.
userName - The user for whom score has to be saved.
gameScore - The score that has to be saved.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; BigDecimal gameScore = new BigDecimal(3500); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.saveUserScore(gameName, userName, gameScore,new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; String userName = "Nick"; double gameScore = 3500; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.SaveUserScore(gameName,userName,gameScore,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message" + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; double gameScore = 3500; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService saveUserScore:gameName gameUserName:userName gameScore:gameScore completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var gameName = "<Enter_your_game_name>" var userName = "userName" var gameScore:Double = 4000 App42API.initializeWithAPIKey("API_KEY" andSecretKey: "SECRET_KEY") scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.saveUserScore(gameName, gameUserName:userName, gameScore:gameScore, completionBlock: { (success, response, exception) -> Void in if(success) { var game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) var scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) var scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; String userName = "Nick"; BigDecimal gameScore = new BigDecimal(3500); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.saveUserScore(gameName,userName,gameScore); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; double gameScore = 3500; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.SaveUserScore(gameName, userName, gameScore, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", userName = "Nick", gameScore = 3500, result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.saveUserScore(gameName,userName,gameScore,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userName = "Nick" local gameScore = 3500 local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:saveUserScore(gameName,userName,gameScore,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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>"; double score = 100; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->SaveUserScore(gameName, userName, score, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n Rank=%s\n",it->getRank().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; double gameScore = 3500; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); Game game = scoreBoardService.SaveUserScore(gameName,userName,gameScore); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $userName = "Nick"; $gameScore = 3500; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->saveUserScore($gameName,$userName,$gameScore); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); } $jsonResponse = $game->toString();const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; double score = 100; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->SaveUserScore(gameName, userName, score, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n Rank=%s\n",it->getRank().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }gameName = "<Enter_your_game_name>"; userName = "Nick"; gameScore = 400000; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") score_board_service = api.build_score_board_service game = score_board_service.save_user_score(gameName, userName, gameScore); puts "gameName is #{game.name}"; score_list = Array.new(); score_list = game.score_list(); for score in score_list do puts "userName is #{score.userName}"; puts "value is #{score.value}"; end json_response = game.to_s();var gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; var gameScore:Number = 40000; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.saveUserScore(gameName,userName,gameScore, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception : " + excption); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; double gameScore = 3500; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.saveUserScore(gameName,userName,gameScore); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Fetche the scores for a game for the specified user name.
Required Parameters
gameName - Name of the game for which score has to be fetched.
userName - The user for whom score has to be fetched.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getScoresByUser(gameName,userName, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); } } 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"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetScoresByUser(gameName,userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getScoresByUser:gameName gameUserName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" let userName = "userName" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getScoresByUser(gameName, gameUserName:userName, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } 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"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getScoresByUser(gameName,userName); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetScoresByUser(gameName, userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } 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 scoreBoardService = new App42ScoreBoard(); scoreBoardService.getScoresByUser(gameName,userName,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getScoresByUser(gameName,userName,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) if table.getn(object:getScoreList()) > 1 then for i=1,table.getn(object:getScoreList()) do print("userName is : "..object:getScoreList()[i]:getUserName()) print("score is : "..object:getScoreList()[i]:getValue()) print("scoreId is : "..object:getScoreList()[i]:getScoreId()) end else print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetScoresByUser(gameName, userName,app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); Game game = scoreBoardService.GetScoresByUser(gameName,userName); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getScoresByUser($gameName,$userName); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetScoresByUser(gameName, userName, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }gameName = "<Enter_your_game_name>"; userName = "Nick"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") score_board_service = api.build_score_board_service game = score_board_service.get_scores_by_user(gameName, userName); puts "gameName is #{game.name}"; score_list = Array.new(); score_list = game.score_list(); for score in score_list do puts "userName is #{score.userName}"; puts "value is #{score.value}"; end json_response = game.to_s();var gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getScoresByUser(gameName,userName, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception is : " + excption); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getScoresByUser(gameName,userName); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Fetch the highest game score for the specified user.
Required Parameters
gameName - Name of the game for which score has to be fetched.
userName - The user for whom score has to be fetched.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getHighestScoreByUser(gameName, userName, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); } } 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"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetHighestScoreByUser(gameName,userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getHighestScoreByUser:gameName gameUserName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" let userName = "userName"; App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getHighestScoreByUser(gameName, gameUserName:userName, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } 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"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getHighestScoreByUser(gameName,userName); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetHighestScoreByUser(gameName, userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } 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 scoreBoardService = new App42ScoreBoard(); scoreBoardService.getHighestScoreByUser(gameName,userName,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getHighestScoreByUser(gameName,userName,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetHighestScoreByUser(gameName, userName,app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); Game game = scoreBoardService.GetHighestScoreByUser(gameName,userName); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getHighestScoreByUser($gameName,$userName); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetHighestScoreByUser(gameName, userName, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }gameName = "<Enter_your_game_name>"; userName = "userName"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") score_board_service = api.build_score_board_service game = score_board_service.get_highest_score_by_user(gameName, userName); puts "gameName is #{game.name}"; score_list = Array.new(); score_list = game.score_list(); for score in score_list do puts "userName is #{score.userName}"; puts "value is #{score.value}"; end json_response = game.to_s();var gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getHighestScoreByUser(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 game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getHighestScoreByUser(gameName,userName); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Fetch the lowest game score for the specified user.
Required Parameters
gameName - Name of the game for which score has to be fetched.
userName - The user for whom score has to be fetched.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getLowestScoreByUser(gameName, userName, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); } } 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"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetLowestScoreByUser(gameName,userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getLowestScoreByUser:gameName gameUserName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" let userName = "userName" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getLowestScoreByUser(gameName, gameUserName:userName, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } 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"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getLowestScoreByUser(gameName,userName); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetLowestScoreByUser(gameName,userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } 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 scoreBoardService = new App42ScoreBoard(); scoreBoardService.getLowestScoreByUser(gameName,userName,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getLowestScoreByUser(gameName,userName,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetLowestScoreByUser(gameName, userName, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); Game game = scoreBoardService.GetLowestScoreByUser(gameName,userName); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getLowestScoreByUser($gameName,$userName); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetLowestScoreByUser(gameName, userName, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }gameName = "<Enter_your_game_name>"; userName = "Nick"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") score_board_service = api.build_score_board_service game = score_board_service.get_lowest_score_by_user(gameName, userName); puts "gameName is #{game.name}"; score_list = Array.new(); score_list = game.score_list(); for score in score_list do puts "userName is #{score.userName}"; puts "value is #{score.value}"; end json_response = game.to_s();var gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getLowestScoreByUser(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 game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getLowestScoreByUser(gameName,userName); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Retrieve the average game score for the specified user.
Required Parameters
gameName - Name of the game for which average score has to be fetched.
userName - The user for whom average score has to be fetched.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getAverageScoreByUser(gameName, userName, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); } } 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"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetAverageScoreByUser(gameName,userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getAverageScoreByUser:gameName userName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var gameName = "<Enter_your_game_name>" var userName = "userName" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getAverageScoreByUser(gameName, gameUserName:userName, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } 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"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getAverageScoreByUser(gameName,userName); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetAverageScoreByUser(gameName,userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); } } 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 scoreBoardService = new App42ScoreBoard(); scoreBoardService.getAverageScoreByUser(gameName,userName,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; console.log("userName is : " + scoreList.userName) console.log("value is : " + scoreList.value) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getAverageScoreByUser(gameName,userName,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) 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"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetAverageScoreByUser(gameName, userName, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); Game game = scoreBoardService.GetAverageScoreByUser(gameName,userName); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); }$gameName = "<Enter_your_game_name>"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getAverageScoreByUser($gameName,$userName); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach( $scoreList as $score ) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); }const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetAverageScoreByUser(gameName, userName, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }gameName = "<Enter_your_game_name>"; userName = "Nick"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") score_board_service = api.build_score_board_service game = score_board_service.get_average_score_by_user(gameName, userName); puts "gameName is #{game.get_name}"; score_list = Array.new(); score_list = game.score_list(); for score in score_list do puts "userName is #{score.userName}"; puts "value is #{score.value}"; endvar gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getAverageScoreByUser(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 game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getAverageScoreByUser(gameName,userName); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); }
Retrieve the Top Rankings for the specified game.
Required Parameters
gameName - Name of the game for which ranks have to be fetched.
String gameName = "<Enter_your_game_name>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopRankings(gameName,new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopRankings(gameName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getTopRankings:gameName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getTopRankings(gameName, completionBlock: { (success, response, exception) -> Void in if(success) { var game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopRankings(gameName); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); }String gameName = "<Enter_your_game_name>"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopRankings(gameName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getTopRankings(gameName,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName) console.log("scoreId is : " + scoreList[i].scoreId) console.log("value is : " + scoreList[i].value) } } else { console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) } }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getTopRankings(gameName,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) if table.getn(object:getScoreList()) > 1 then for i=1,table.getn(object:getScoreList()) do print("userName is : "..object:getScoreList()[i]:getUserName()) print("score is : "..object:getScoreList()[i]:getValue()) end else print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) 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>"; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopRankings(gameName, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetTopRankings(gameName); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getTopRankings($gameName); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopRankings(gameName, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }game_name = "<Enter_your_game_name>"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") score_board_service = api.build_score_board_service game = score_board_service.get_top_rankings(game_name); puts "gameName is #{game.name}"; score_list = Array.new(); score_list = game.score_list(); for score in score_list do puts "userName is #{score.user_name}"; puts "value is #{score.value}"; end json_response = game.to_s();var gameName:String = "<Enter_your_game_name>"; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopRankings(gameName, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopRankings(gameName); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Retrieve the Top Rankings for the specified game in date range.
Note : It will return max 30 days data prior to the end date. For example, it will return the data starting from “01-01-20..”, if your end date is “30-01-20..”.
Required Parameters
gameName - Name of the game for which ranks have to be fetched.
startDate - Start date from which the rankings have to be fetched.
endDate - End date up to which the rankings have to be fetched.
String gameName = "<Enter_your_game_name>"; Date startDate = null; /* Get date from your source */ Date endDate = null; /* Get date from your source */ App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopRankings(gameName,startDate,endDate,new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; DateTime startDate = null; /* Get date from your source */ DateTime endDate = null; /* Get date from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopRankings(gameName,startDate,endDate,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSDate *startDate =nil; /* Get date from your source */ NSDate *endDate = nil; /* Get date from your source */ [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getTopRankings:gameName startDate:startDate endDate:endDate completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" let startDate = NSDate(timeIntervalSinceNow: -24*60*60*2) //change this as required let endDate = NSDate() //current date App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getTopRankings(gameName, startDate:startDate, endDate:endDate, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) var scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; Date startDate = null; /* Get date from your source */ Date endDate = null; /* Get date from your source */ App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopRankings(gameName,startDate,endDate); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }String gameName = "<Enter_your_game_name>"; DateTime startDate = null; /* Get date from your source */ DateTime endDate = null; /* Get date from your source */ App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopRankings(gameName, startDate, endDate, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>"; var startDate = null; /* Get date from your source */ var endDate = null; /* Get date from your source */ var result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getTopRankingsByDate(gameName,startDate,endDate,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName) console.log("scoreId is : " + scoreList[i].scoreId) console.log("value is : " + scoreList[i].value) } } else { console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) } }, error: function(error) { } });Coming Soonconst char* gameName = "<Enter_your_game_name>"; tm start_date = nullptr; /* Get date from your source */; tm end_date = nullptr; /* Get date from your source */; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopRankings(gameName, &start_date, &end_date, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; DateTime startDate = null; /* Get date from your source */ DateTime endDate = null; /* Get date from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetTopRankings(gameName,startDate,endDate); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $startDate = null; /* Get date from your source */ $endDate = null; /* Get date from your source */ App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getTopRankings($gameName,$startDate,$endDate); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; tm start_date = nullptr; /* Get date from your source */; tm end_date = nullptr; /* Get date from your source */; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopRankings(gameName, &start_date, &end_date, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var startDate:Date = null; /* Get date from your source */ var endDate:Date = null; /* Get date from your source */ App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopRankingsByDate(gameName,startDate,endDate, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; Date startDate = null; /* Get date from your source */ Date endDate = null; /* Get date from your source */ App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopRankings(gameName,startDate,endDate); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Retrieve the Top Rankings for the specified game by group.
Required Parameters
gameName - Name of the game for which ranks have to be fetched.
userList - List of users from whom ranking has to be fetched.
String gameName = "<Enter_your_game_name>"; ArrayList<String> userList = new ArrayList<String>(); userList.add("Nick"); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopRankingsByGroup(gameName,userList,new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; IList<String> userList = new IList<String>(); userList.Add("Nick"); App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopRankingsByGroup(gameName,userList,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSArray *userList = [[NSArray alloc]initWithObjects:@"Nick", nil]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getTopRankingsByGroup:gameName group:userList completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" let userList = ["Paul","Nick","Jack"] App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getTopRankingsByGroup(gameName, group:userList, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; ArrayList<String> userList = new ArrayList<String>(); userList.add("Nick"); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopRankingsByGroup(gameName,userList); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }String gameName = "<Enter_your_game_name>"; IList<String> userList = new List<String>(); userList.Add("Nick"); App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopRankingsByGroup(gameName, userList, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>"; var userList = new Array(); userList.push("Nick") var result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getTopRankingsByGroup(gameName,userList,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName) console.log("scoreId is : " + scoreList[i].scoreId) console.log("value is : " + scoreList[i].value) } } else { console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) } }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userList = {} userList[1] = "Nick" userList[2] = "John" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getTopRankingsByGroup(gameName,userList,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) if table.getn(object) > 1 then for i=1,table.getn(object) do print("userName is : "..game:getScoreList()[i]:getUserName()) print("score is : "..game:getScoreList()[i]:getValue()) print("scoreId is : "..game:getScoreList()[i]:getScoreId()) end else print("userName is : "..game:getScoreList():getUserName()) print("score is : "..game:getScoreList():getValue()) print("scoreId is : "..game:getScoreList():getScoreId()) 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>"; std::vector<string>userList; userList.push_back("Nick"); App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopRankingsByGroup(gameName, userList,app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; IList<String> userList = new List<String>(); userList.Add("Nick"); App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetTopRankingsByGroup(gameName,userList); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $userList = array(); array_push($userList, "Nick"); App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getTopRankingsByGroup($gameName,$userList); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; std::vector<string>userList; userList.push_back("Nick"); App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopRankingsByGroup(gameName, userList,this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var startDate:Date = null; /* Get date from your source */ var endDate:Date = null; /* Get date from your source */ App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopRankingsByDate(gameName,startDate,endDate, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; Vector userList = new Vector(); userList.addElement("Nick"); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopRankingsByGroup(gameName,userList); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Retrieve the Top N Rankings for the specified game.
Required Parameters
gameName - Name of the game for which ranks have to be fetched.
max - Maximum number of records to be fetched.
String gameName = "<Enter_your_game_name>"; int max = 10; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankings(gameName, max,new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; int max = 10; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopNRankings(gameName,max,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; int max = 10; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getTopNRankings:gameName max:max completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" let max:Int32 = 5 App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getTopNRankings(gameName, max:max, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; int max = 10; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankings(gameName,max); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }String gameName = "<Enter_your_game_name>"; int max = 10; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopNRankings(gameName,max, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", max = 10, result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getTopNRankings(gameName,max,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName) console.log("scoreId is : " + scoreList[i].scoreId) console.log("value is : " + scoreList[i].value) } } else { console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) } }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local max = 5 local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getTopNRankings(gameName,max,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) if table.getn(object:getScoreList()) > 1 then for i=1,table.getn(object:getScoreList()) do print("userName is : "..object:getScoreList()[i]:getUserName()) print("score is : "..object:getScoreList()[i]:getValue()) print("scoreId is : "..object:getScoreList()[i]:getScoreId()) end else print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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>"; int max =10; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopNRankings(gameName, max,app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; int max = 10; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetTopNRankings(gameName,max); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $max = 10; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getTopNRankings($gameName,$max); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; int max =10; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopNRankings(gameName, max,this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }game_name = "<Enter_your_game_name>"; max = 2; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") score_board_service = api.build_score_board_service game = score_board_service.get_top_n_rankings(game_name,max); puts "Game Name is #{game.name}"; score_list = Array.new(); scoreList = game.score_list(); for score in score_list do puts "userName is #{score.user_name}"; puts "value is #{score.value}"; endvar gameName:String = "<Enter_your_game_name>"; var max:int = 5; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankings(gameName,max, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; int max = 10; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankings(gameName,max); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
This function will return the specified number of top rankers in a specific game.
Required Parameters
gameName - Name of the game for which ranks have to be fetched.
max - Maximum number of records to be fetched.
String gameName = "<Enter_your_game_name>"; int max = 10; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankers(gameName, max, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; int max = 10; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopNRankers(gameName,max,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; int max = 10; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getTopNRankers:gameName max:max completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" let max:Int32 = 10 App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getTopNRankers(gameName, max:max, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) var scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; int max = 10; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankers(gameName,max); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }String gameName = "<Enter_your_game_name>"; int max = 10; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopNRankers(gameName, max, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", max = 10, result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getTopNRankers(gameName,max,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName) console.log("scoreId is : " + scoreList[i].scoreId) console.log("value is : " + scoreList[i].value) } } else { console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) } }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local max = 5 local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getTopNRankers(gameName,max,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) if table.getn(object:getScoreList()) > 1 then for i=1,table.getn(object:getScoreList()) do print("userName is : "..object:getScoreList()[i]:getUserName()) print("score is : "..object:getScoreList()[i]:getValue()) print("scoreId is : "..object:getScoreList()[i]:getScoreId()) end else print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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>"; int max =10; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopNRankers(gameName, max, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; int max = 10; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetTopNRankers(gameName,max); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $max = 10; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getTopNRankers($gameName,$max); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; int max =10; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopNRankers(gameName, max, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var max:int = 5; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankers(gameName,max, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; int max = 10; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankers(gameName,max); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Retrieve the Top Rankings for the specified game in date range.
Note : It will return max 30 days data prior to the end date. Also the data which will get returned will not be in real time, there will be a lag of few hours.
Required Parameters
gameName - Name of the game for which ranks have to be fetched.
startDate - Start date from which the rankings have to be fetched.
endDate - End date up to which the rankings have to be fetched.
max - Max rankers to get.
String gameName = "<Enter_your_game_name>"; Date startDate = null; /* Get date from your source */ Date endDate = null; int max =10; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankers(gameName, startDate, endDate, max, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; DateTime startTime = null; DateTime endTime = null; int max = 10; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.getTopNRankers(gameName,startDate,endDate,max,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }int max = 10; NSString *gameName = @"<Enter_your_game_name>"; NSDate *startDate =nil; /* Get date from your source */ NSDate *endDate = nil; /* Get date from your source */ [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getTopNRankers:gameName startDate:startDate endDate:endDate max:max completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var gameName = "<Enter_your_game_name>" var startDate = NSDate(timeIntervalSinceNow: -24*60*60) var endDate = NSDate() var max:Int32 = 10 App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getTopNRankers(gameName, startDate:startDate, endDate:endDate, max:max, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })int max = 10; String gameName = "<Enter_your_game_name>"; Date startDate = null; /* Get date from your source */ Date endDate = null; /* Get date from your source */ App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankers(gameName,startDate,endDate,max); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }int max = 10; String gameName = "<Enter_your_game_name>"; DateTime startDate = null; /* Get date from your source */ DateTime endDate = null; /* Get date from your source */ App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.getTopNRankers(gameName, startDate, endDate, max, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var max =1; var gameName = "<Enter_your_game_name>"; var startDate = null; /* Get date from your source */ var endDate = null; /* Get date from your source */ var result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getTopNRankersByDate(gameName,startDate,endDate,max,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName) console.log("scoreId is : " + scoreList[i].scoreId) console.log("value is : " + scoreList[i].value) } } else { console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) } }, error: function(error) { } });Coming Soonconst char* gameName = "<Enter_your_game_name>"; tm start_date = nullptr; /* Get date from your source */; tm end_date = nullptr; /* Get date from your source */; int max =10; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopNRankers(gameName, &start_date, &end_date, max, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }int max = 10; String gameName = "<Enter_your_game_name>"; DateTime startDate = null; /* Get date from your source */ DateTime endDate = null; /* Get date from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.getTopNRankers(gameName,startDate,endDate,max); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }int max = 10; $gameName = "<Enter_your_game_name>"; $startDate = null; /* Get date from your source */ $endDate = null; /* Get date from your source */ App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getTopNRankers($gameName,$startDate,$endDate,$max); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; tm start_date = nullptr; /* Get date from your source */; tm end_date = nullptr; /* Get date from your source */; int max =10; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopNRankers(gameName, &start_date, &end_date, max, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var startDate:Date = null; /* Get date from your source */ var endDate:Date = null; /* Get date from your source */ var max:int = 5; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankers(gameName,startDate,endDate,max, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; Date startDate = null; /* Get date from your source */ Date endDate = null; /* Get date from your source */ Integer max = new Integer(1); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankers(gameName,startDate,endDate,max); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Retrieve the Top N Rankers from a specific group of people in a game.
Required Parameters
gameName - Name of the game for which ranks have to be fetched.
userList - List of users from whom ranking has to be fetched.
String gameName = "<Enter_your_game_name>"; ArrayList<String> userList = new ArrayList<String>(); userList.add("Nick"); userList.add("John"); userList.add("Balley"); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankersByGroup(gameName, userList, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; IList<String> userList = new IList<String>(); userList.Add("Nick"); userList.Add("John"); userList.Add("Balley"); App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.getTopNRankersByGroup(gameName,userList,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSArray *userList = [[NSArray alloc]initWithObjects:@"Nick", nil]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getTopRankersByGroup:gameName group:userList completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableString gameName = "<Enter_your_game_name>"; ArrayList<String> userList = new ArrayList<String>(); userList.add("Nick"); userList.add("John"); userList.add("Balley"); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankersByGroup(gameName,userList); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }String gameName = "<Enter_your_game_name>"; IList<String> userList = new List<String>(); userList.Add("Nick"); userList.Add("John"); userList.Add("Balley"); App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.getTopNRankersByGroup(gameName,userList, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>"; var userList = new Array(); userList.push("Nick"); userList.push("John"); userList.push("Balley"); var result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getTopNRankersByGroup(gameName,userList,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName) console.log("scoreId is : " + scoreList[i].scoreId) console.log("value is : " + scoreList[i].value) } } else { console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) } }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userList = {} userList[1] = "Nick" userList[2] = "John" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getTopNRankersByGroup(gameName,userList,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) if table.getn(object:getScoreList()) > 1 then for i=1,table.getn(object:getScoreList()) do print("userName is : "..object:getScoreList()[i]:getUserName()) print("score is : "..object:getScoreList()[i]:getValue()) print("scoreId is : "..object:getScoreList()[i]:getScoreId()) end else print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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>"; std::vector<string>userList; userList.push_back("Nick"); userList.push_back("John"); userList.push_back("Balley"); App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopRankersByGroup(gameName, userList,app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; IList<String> userList = new List<String>(); userList.Add("Nick"); userList.Add("John"); userList.Add("Balley"); App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.getTopNRankersByGroup(gameName,userList); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $userList = array(); array_push($userList, "Nick"); array_push($userList, "John"); array_push($userList, "Balley"); App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getTopNRankersByGroup($gameName,$userList); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; std::vector<string>userList; userList.push_back("Nick"); userList.push_back("John"); userList.push_back("Balley"); App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopRankersByGroup(gameName, userList,this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var userList:Array = new Array(); userList.push("Nick"); userList.push("John"); userList.push("Balley"); App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankersByGroup(gameName,userList, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; Vector userList = new Vector(); userList.addElement("Nick"); userList.addElement("John"); userList.addElement("Balley"); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankersByGroup(gameName,userList); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Fetch the rank of user in a game along with user score.
Required Parameters
gameName - Name of the game for which score has to be fetched.
userName - The user for whom score has to be fetched.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getUserRanking(gameName, userName, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("rank is : " + game.getScoreList().get(i).getRank()); } } 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"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetUserRanking(gameName,userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("rank is : " + game.GetScoreList()[i].GetRank()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getUserRanking:gameName userName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); NSLog(@"Rank is = %f",score.rank); } } 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 gameName = "<Enter_your_game_name>" let userName = "userName" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getUserRanking(gameName, userName:userName, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } 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"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getUserRanking(gameName,userName); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("rank is : " + game.getScoreList().get(i).getRank()); }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetUserRanking(gameName, userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("rank is : " + game.GetScoreList()[i].GetRank()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } 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 scoreBoardService = new App42ScoreBoard(); scoreBoardService.getUserRanking(gameName,userName,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; console.log("userName is : " + scoreList.userName) console.log("rank is : " + scoreList.rank) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getUserRanking(gameName,userName,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) if table.getn(object:getScoreList()) > 1 then for i=1,table.getn(object:getScoreList()) do print("userName is : "..object:getScoreList()[i]:getUserName()) print("score is : "..object:getScoreList()[i]:getValue()) print("scoreId is : "..object:getScoreList()[i]:getScoreId()) end else print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetUserRanking(gameName, userName,app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n Rank=%0.0lf\n",it->getRank()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetUserRanking(gameName,userName); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("rank is : " + game.GetScoreList()[i].GetRank()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getUserRanking($gameName,$userName); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Rank is : " . $score->getRank()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetUserRanking(gameName, userName, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n Rank=%0.0lf\n",it->getRank()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }gameName = "<Enter_your_game_name>"; userName = "Nick"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") score_board_service = api.build_score_board_service game = score_board_service.get_user_ranking(gameName,userName); puts"Game Name is #{game.name}"; score_list = Array.new(); score_list = game.score_list(); for score in score_list do puts "userName is #{score.userName}"; puts "value is #{score.value}"; end json_response = game.to_s();var gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getUserRanking(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 game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("rank is : " + Score(game.getScoreList()[i]).getRank()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getUserRanking(gameName,userName); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("rank is " + score.getRank()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
This function will return the last score attained by the specified user in the game.
Required Parameters
gameName - Name of the game for which score has to be fetched.
userName - The user for whom score has to be fetched.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getLastScoreByUser(gameName, userName, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } 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"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetLastScoreByUser(gameName,userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getLastScoreByUser:gameName userName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" let userName = "userName" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getLastScoreByUser(gameName, userName:userName, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } 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"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getLastScoreByUser(gameName,userName); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetLastScoreByUser(gameName, userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } 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 scoreBoardService = new App42ScoreBoard(); scoreBoardService.getLastScoreByUser(gameName,userName,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getLastScoreByUser(gameName,userName,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetLastScoreByUser(gameName, userName, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetLastScoreByUser(gameName,userName); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getLastScoreByUser($gameName,$userName); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetLastScoreByUser(gameName, userName, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getLastScoreByUser(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 game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getLastScoreByUser(gameName,userName); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
This function returns the score attained by the specified user in the last game session.
Required Parameters
userName - Name of the user for whom score has to be fetched.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getLastGameScore(userName, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetLastGameScore(userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getLastGameScore:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getLastGameScore(userName, completionBlock: { (success, response, exception) -> Void in if(success) { var game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getLastGameScore(userName); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }String userName = "Nick"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetLastGameScore(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getLastGameScore(userName,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) }, error: function(error) { } });local userName = "Nick" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getLastGameScore(userName,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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* userName = "<Enter_your_user_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetLastGameScore(userName,app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetLastGameScore(userName); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getLastGameScore($userName); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* userName = "<Enter_your_user_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetLastGameScore(userName, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getLastGameScore(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 game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getLastGameScore(userName); System.out.println("gameName is " + game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }
Edit the score value of the game in existing score ID.
Required Parameters
scoreId - Score ID of the game User for which value has to be edited.
gameScore - The score that has to be added.
String scoreId = "<Enter_score_id>"; BigDecimal gameScore = new BigDecimal(3500); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.editScoreValueById(scoreId, gameScore, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String scoreId = "<Enter_score_id>"; double gameScore = 3500; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.EditScoreValueById(scoreId,gameScore,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *scoreId = @"scoreId"; double gameScore = 3500; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService editScoreValueById:scoreId gameScore:gameScore completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 scoreId = "scoreId" let score:Double = 9000 App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.editScoreValueById(scoreId, gameScore:score, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) let scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String scoreId = "<Enter_score_id>"; BigDecimal gameScore = new BigDecimal(3500); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.editScoreValueById(scoreId,gameScore); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }String scoreId = "<Enter_score_id>"; double gameScore = 3500; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.EditScoreValueById(scoreId, gameScore, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var scoreId = "<Enter_score_id>", gameScore = 3500, result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.editScoreValueById(scoreId,gameScore,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) }, error: function(error) { } });local scoreId = "<Enter_score_id>" local gameScore = 3500 local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:editScoreValueById(scoreId,gameScore,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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* scoreId = "<Enter_score_id>"; double score = 200; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->EditScoreValueById(scoreId, score, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String scoreId = "<Enter_score_id>"; double gameScore = 3500; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.EditScoreValueById(scoreId,gameScore); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$scoreId = "<Enter_score_id>"; $gameScore = 3500; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->editScoreValueById($scoreId,$gameScore); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* scoreId = "<Enter_score_id>"; double score = 200; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->EditScoreValueById(scoreId, score, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar scoreId:String = "scoreId"; var gameScore:Number = 2000; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.editScoreValueById(scoreId,gameScore, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString scoreId = "<Enter_score_id>"; double gameScore = 3500; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.editScoreValueById(scoreId,gameScore); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
This function will return the specified number of top rankers in a specific game from buddy group.
Required Parameters
gameName- Name of the game.
userName- Name of the user who fetches top rankers from group.
ownerName- Group owner name.
groupName- Name of the group.
String gameName = "<Enter_your_game_name>"; String userName = "userName"; String ownerName = "ownerName"; String groupName = "groupName"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopRankersFromBuddyGroup(gameName, userName,ownerName, groupName,new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; String userName = "userName"; String ownerName = "ownerName"; String groupName = "groupName"; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.getTopRankersFromBuddyGroup(gameName, userName, ownerName, groupName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"UserName"; NSString *ownerName = @"OwnerName"; NSString *groupName = @"GroupName"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getTopRankersFromBuddyGroup:gameName userName:userName ownerName:ownerName groupName:groupName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" let userName = "userName" let ownerName = "ownerName" let groupName = "groupName" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getTopRankersFromBuddyGroup(gameName, userName:userName, ownerName:ownerName, groupName:groupName, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) var scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; String userName = "userName"; String ownerName = "ownerName"; String groupName = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopRankersFromBuddyGroup(gameName, userName, ownerName, groupName); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }String gameName = "<Enter_your_game_name>"; String userName = "userName"; String ownerName = "ownerName"; String groupName = "groupName"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopRankersFromBuddyGroup(gameName, userName, ownerName, groupName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", userName = "Nick", ownerName = "ownerName", groupName = "groupName", var result ; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoard.getTopRankersFromBuddyGroup(gameName,userName,ownerName,groupName,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName) console.log("scoreId is : " + scoreList[i].scoreId) console.log("value is : " + scoreList[i].value) } } else { console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) } }, error: function(error) { } });Coming SoonComing SoonString gameName = "<Enter_your_game_name>"; String userName = "userName"; String ownerName = "ownerName"; String groupName = "groupName"; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetTopRankersFromBuddyGroup(gameName, userName, ownerName, groupName); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $userName = "userName"; $ownerName = "ownerName"; $groupName = "groupName"; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getTopRankersFromBuddyGroup($gameName, $userName, $ownerName, $groupName); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }Coming SoonComing SoonComing SoonComing SoonString gameName = "gameName" ; String buddyName = "buddyName"; String ownerName = "ownerName" ; String groupName = "groupName"; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopRankersFromBuddyGroup(gameName, buddyName, ownerName, groupName); System.out.println("GameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
This method helps to fetch the top N rankers from user’s facebook friends.
Required Parameters
gameName - Game name for which top N rankers has to be fetched.
accessToken - Facebook access token of the user who is fetching the record.
max - Max number of rankers to be fetched.
String gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankersFromFacebook(gameName, accessToken, max, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i=0;i<game.getScoreList().size();i++) { System.out.println("UserName is:"+game.getScoreList().get(i).getUserName()); System.out.println("Value is"+game.getScoreList().get(i).getValue()); System.out.println("Created On is: "+game.getScoreList().get(i).getCreatedOn()); System.out.println("ScoreId is: "+game.getScoreList().get(i).getScoreId()); System.out.println("id is :"+ game.getScoreList().get(i).getFacebookProfile().getId()); System.out.println("friend name is "+ game.getScoreList().get(i).getFacebookProfile().getName()); System.out.println("picture url is "+ game.getScoreList().get(i).getFacebookProfile().getPicture()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopNRankersFromFacebook(gameName, accessToken, max, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score value is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); Console.WriteLine("Created On : " + game.GetScoreList()[i].GetCreatedOn()); Console.WriteLine("Facebook id is : " + game.GetScoreList()[i].GetFacebookProfile().GetId()); Console.WriteLine("Facebook name is : " + game.GetScoreList()[i].GetFacebookProfile().GetName()); Console.WriteLine("Facebook picture is : " + game.GetScoreList()[i].GetFacebookProfile().GetPicture()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *fbAccessToken = @"<Enter_facebook_access_token>"; int max = 2; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getTopNRankersFromFacebook:gameName fbAccessToken:fbAccessToken max:max completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); NSLog(@"Facebook Id = %@",score.facebookProfile.fbId); NSLog(@"Friend Name = %@",score.facebookProfile.name); NSLog(@"Friend Profile Pic = %@",score.facebookProfile.picture); } } 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 gameName = "<Enter_your_game_name>" let accessToken = "<Enter_facebook_access_token>" let max:Int32 = 10 App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getTopNRankersFromFacebook(gameName, fbAccessToken:accessToken, max:max, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) var scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) let scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankersFromFacebook(gameName, accessToken, max); System.out.println("Game Name is : "+game.getName()); for(int i=0;i<game.getScoreList().size();i++) { System.out.println("UserName is:"+game.getScoreList().get(i).getUserName()); System.out.println("Value is"+game.getScoreList().get(i).getValue()); System.out.println("Created On is: "+game.getScoreList().get(i).getCreatedOn()); System.out.println("ScoreId is: "+game.getScoreList().get(i).getScoreId()); System.out.println("id is :"+ game.getScoreList().get(i).getFacebookProfile().getId()); System.out.println("friend name is "+ game.getScoreList().get(i).getFacebookProfile().getName()); System.out.println("picture url is "+ game.getScoreList().get(i).getFacebookProfile().getPicture()); }String gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopNRankersFromFacebook(gameName, accessToken, max, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i < game.GetScoreList().Count; i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score value is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); App42Log.Console("Created On : " + game.GetScoreList()[i].GetCreatedOn()); App42Log.Console("Facebook id is : " + game.GetScoreList()[i].GetFacebookProfile().GetId()); App42Log.Console("Facebook name is : " + game.GetScoreList()[i].GetFacebookProfile().GetName()); App42Log.Console("Facebook picture is : " + game.GetScoreList()[i].GetFacebookProfile().GetPicture()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>"; var max = 2; var accessToken= "<Enter_facebook_access_token>"; var result, var facebookResult; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getTopNRankersFromFacebook(gameName, accessToken, max,{ success: function(object) { var scoreBoard = JSON.parse(object); result = scoreBoard.app42.response.games.game.scores.score; if (result instanceof Array) { for(var i = 0; i < result.length; i++) { console.log("UserName is:"+result[i].userName) console.log("Value is"+result[i].value) console.log("ScoreId is: "+result[i].scoreId) console.log("Created On : " + result[i].createdOn) facebookResult = result[i].facebookProfile; console.log("Facebook id is :"+facebookResult.name) console.log("Facebook friend name is "+facebookResult.id) console.log("Facebook picture url is "+ facebookResult.picture) } } else { console.log("UserName is:"+result.userName) console.log("Value is"+result.value) console.log("ScoreId is: "+result.scoreId) console.log("Created On : " + result.createdOn) facebookResult = result.facebookProfile; console.log("Facebook id is :"+facebookResult.name) console.log("Facebook friend name is "+facebookResult.id) console.log("Facebook picture url is "+ facebookResult.picture) } }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local accessToken = "<Enter_facebook_access_token>" local max = 2 local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getTopNRankersFromFacebook(gameName,accessToken,max,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) if table.getn(object:getScoreList()) > 1 then for i=1,table.getn(object:getScoreList()) do print("userName is : "..object:getScoreList()[i]:getUserName()) print("score is : "..object:getScoreList()[i]:getValue()) print("scoreId is : "..object:getScoreList()[i]:getScoreId()) print("Facebook id is : "..object:getScoreList()[i]:getFacebookProfile():getId()); print("Facebook name is : "..object:getScoreList()[i]:getFacebookProfile():getName()); print("Facebook picture is : "..object:getScoreList()[i]:getFacebookProfile():getPicture()); end else print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) print("Facebook id is : "..object:getScoreList():getFacebookProfile():getId()); print("Facebook name is : "..object:getScoreList():getFacebookProfile():getName()); print("Facebook picture is : "..object:getScoreList():getFacebookProfile():getPicture()); 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* fbAccessToken = "<Enter_facebook_access_token>"; int max = 5; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopNRankersFromFacebook(gameName, fbAccessToken, max, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { vector<App42Score> scores = scoreResponse->scores; for(std::vector<App42Score>::iterator it = scores.begin(); it != scores.end(); ++it) { printf("\n CreatedOn=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); printf("\n Facebook User Name = %s",it->facebookProfile.getName().c_str()); printf("\n Facebook Id = %s",it->facebookProfile.getFbId().c_str()); printf("\n Facebook Picture URL = %s",it->facebookProfile.getPicture().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetTopNRankersFromFacebook(gameName, accessToken, max); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score value is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); Console.WriteLine("Created On : " + game.GetScoreList()[i].GetCreatedOn()); Console.WriteLine("Facebook id is : " + game.GetScoreList()[i].GetFacebookProfile().GetId()); Console.WriteLine("Facebook name is : " + game.GetScoreList()[i].GetFacebookProfile().GetName()); Console.WriteLine("Facebook picture is : " + game.GetScoreList()[i].GetFacebookProfile().GetPicture()); }$gameName = "<Enter_your_game_name>"; $accessToken = "<Enter_facebook_access_token>"; $max = 2; App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getTopNRankersFromFacebook($gameName, $accessToken, $max); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); print_r("Friend Name:" . $score->getFacebookProfile()->getName()); print_r("Id :" . $score->getFacebookProfile()->getId()); print_r("Picture Url: " . $score->getFacebookProfile()->getPicture()); }const char* gameName = "<Enter_your_game_name>"; const char* fbAccessToken = "<Enter_facebook_access_token>"; int max = 5; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopNRankersFromFacebook(gameName, fbAccessToken, max, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { vector<App42Score> scores = scoreResponse->scores; for(std::vector<App42Score>::iterator it = scores.begin(); it != scores.end(); ++it) { printf("\n CreatedOn=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); printf("\n Facebook User Name = %s",it->facebookProfile.getName().c_str()); printf("\n Facebook Id = %s",it->facebookProfile.getFbId().c_str()); printf("\n Facebook Picture URL = %s",it->facebookProfile.getPicture().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String="<Enter_your_game_name>"; var accessToken:String="<Enter_facebook_access_token>"; var max:int= 5; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankersFromFacebook(gameName, accessToken , max , new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var facebookProfile:FacebookProfile; if(response is Game) { var score:Score = new Score(); var gameResponse:Game = Game(response); trace("GameName is : " + gameResponse.getName()); for(var l:int =0;l<gameResponse.getScoreList().length;l++) { score = Score(gameResponse.getScoreList()[l]); trace("username " +score.getUserName()); trace("value " +score.getValue()); trace("scoreId " +score.getScoreId()); trace("created on"+score.getCreatedOn()); facebookProfile = FacebookProfile(score.getFacebookList()[l]); trace("FB Id is : " + facebookProfile.getId()); trace("FB Name is : " + facebookProfile.getName()); trace("FB Picture is : " + facebookProfile.getPicture()); } } } public function onException(excption:App42Exception):void { outputField.text += "" + excption; } }Not AvailableString gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game score = scoreBoardService.getTopNRankersFromFacebook(gameName, accessToken, max); for(int i=0;i<score.getScoreList().size();i++) { System.out.println("UserName is:"+ ((Game.Score)score.getScoreList().elementAt(i)).getUserName()); System.out.println("Value is"+((Game.Score)score.getScoreList().elementAt(i)).getValue()); System.out.println("ScoreId is: "+ ((Game.Score)score.getScoreList().elementAt(i)).getScoreId()); System.out.println("Created On is: "+((Game.Score)score.getScoreList().elementAt(i)).getCreatedOn()); System.out.println("Facebook id is :"+ ((Game.Score)score.getScoreList().elementAt(i)).getFacebookProfile().getId()); System.out.println("Facebook friend name is "+ ((Game.Score)score.getScoreList().elementAt(i)).getFacebookProfile().getName()); System.out.println("Facebook picture url is "+ ((Game.Score)score.getScoreList().elementAt(i)).getFacebookProfile().getPicture()); }
Fetch the top N rankers from your facebook friends between specific date.
Note : It will return max 30 days data prior to the end date. Also, the data which will get returned will not be in real time, there will be a lag of few hours.
Required Parameters
gameName - Game name for which top N rankers has to fetch.
accessToken - Facebook access token of the user who is fetching the record.
max - Max number of rankers to be fetched.
startDate - Start date from which the rankers have to be fetched.
endDate - End date up to which the rankers have to be fetched.
String gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; Date startDate = null; /* Get date from your source */ Date endDate = null; /* Get date from your source */ App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankersFromFacebook(gameName, accessToken, startDate, endDate, max, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i=0;i<game.getScoreList().size();i++) { System.out.println("UserName is:"+game.getScoreList().get(i).getUserName()); System.out.println("Value is"+game.getScoreList().get(i).getValue()); System.out.println("Created On is: "+game.getScoreList().get(i).getCreatedOn()); System.out.println("ScoreId is: "+game.getScoreList().get(i).getScoreId()); System.out.println("id is :"+ game.getScoreList().get(i).getFacebookProfile().getId()); System.out.println("friend name is "+ game.getScoreList().get(i).getFacebookProfile().getName()); System.out.println("picture url is "+ game.getScoreList().get(i).getFacebookProfile().getPicture()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; DateTime startDate = null; /* Get date from your source */ DateTime endDate = null; /* Get date from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopNRankersFromFacebook(gameName, accessToken, startDate,endDate,max, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score value is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); Console.WriteLine("Created On : " + game.GetScoreList()[i].GetCreatedOn()); Console.WriteLine("Facebook id is : " + game.GetScoreList()[i].GetFacebookProfile().GetId()); Console.WriteLine("Facebook name is : " + game.GetScoreList()[i].GetFacebookProfile().GetName()); Console.WriteLine("Facebook picture is : " + game.GetScoreList()[i].GetFacebookProfile().GetPicture()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *fbAccessToken = @"<Enter_facebook_access_token>"; int max = 2; NSDate *startDate = nil; NSDate *endDate = nil; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getTopNRankersFromFacebook:gameName fbAccessToken:fbAccessToken startDate:startDate endDate:endDate max:max completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); NSLog(@"Facebook Id = %@",score.facebookProfile.fbId); NSLog(@"Friend Name = %@",score.facebookProfile.name); NSLog(@"Friend Profile Pic = %@",score.facebookProfile.picture); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var gameName = "<Enter_your_game_name>" var accessToken = "<Enter_facebook_access_token>" var max:Int32 = 10 var startDate = NSDate().laterDate(NSDate()) var endDate = NSDate() App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getTopNRankersFromFacebook(gameName, fbAccessToken:accessToken, startDate:startDate, endDate:endDate, max:max, completionBlock: { (success, response, exception) -> Void in if(success) { var game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) var scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) var scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; Date startDate = null; /* Get date from your source */ Date endDate = null; /* Get date from your source */ App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankersFromFacebook(gameName, accessToken,startDate,endDate, max); System.out.println("Game Name is : "+game.getName()); for(int i=0;i<game.getScoreList().size();i++) { System.out.println("UserName is:"+game.getScoreList().get(i).getUserName()); System.out.println("Value is"+game.getScoreList().get(i).getValue()); System.out.println("Created On is: "+game.getScoreList().get(i).getCreatedOn()); System.out.println("ScoreId is: "+game.getScoreList().get(i).getScoreId()); System.out.println("id is :"+ game.getScoreList().get(i).getFacebookProfile().getId()); System.out.println("friend name is "+ game.getScoreList().get(i).getFacebookProfile().getName()); System.out.println("picture url is "+ game.getScoreList().get(i).getFacebookProfile().getPicture()); }String gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; DateTime startDate = null; /* Get date from your source */ DateTime endDate = null; /* Get date from your source */ App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopNRankersFromFacebook(gameName, accessToken,startDate,endDate, max, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i < game.GetScoreList().Count; i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score value is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); App42Log.Console("Created On : " + game.GetScoreList()[i].GetCreatedOn()); App42Log.Console("Facebook id is : " + game.GetScoreList()[i].GetFacebookProfile().GetId()); App42Log.Console("Facebook name is : " + game.GetScoreList()[i].GetFacebookProfile().GetName()); App42Log.Console("Facebook picture is : " + game.GetScoreList()[i].GetFacebookProfile().GetPicture()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>"; var startDate = null; /* Get date from your source */ var endDate = null; /* Get date from your source */ var max = 2; var accessToken= "<Enter_facebook_access_token>"; var result, var facebookResult; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getTopNRankersFromFacebookByDateRange(gameName, accessToken, startDate,endDate, max,{ success: function(object) { var scoreBoard = JSON.parse(object); result = scoreBoard.app42.response.games.game.scores.score; if (result instanceof Array) { for(var i = 0; i < result.length; i++) { console.log("UserName is:"+result[i].userName) console.log("Value is"+result[i].value) console.log("ScoreId is: "+result[i].scoreId) console.log("Created On : " + result[i].createdOn) facebookResult = result[i].facebookProfile; console.log("Facebook id is :"+facebookResult.name) console.log("Facebook friend name is "+facebookResult.id) console.log("Facebook picture url is "+ facebookResult.picture) } } else { console.log("UserName is:"+result.userName) console.log("Value is"+result.value) console.log("ScoreId is: "+result.scoreId) console.log("Created On : " + result.createdOn) facebookResult = result.facebookProfile; console.log("Facebook id is :"+facebookResult.name) console.log("Facebook friend name is "+facebookResult.id) console.log("Facebook picture url is "+ facebookResult.picture) } }, error: function(error) { } });Coming Soonconst char* gameName = "<Enter_your_game_name>"; const char* fbAccessToken = "<Enter_facebook_access_token>"; int max = 5; tm start_date = nullptr; /* Get date from your source */; tm end_date = nullptr; /* Get date from your source */; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopNRankersFromFacebook(gameName, fbAccessToken, &start_date, &end_date, max, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { vector<App42Score> scores = scoreResponse->scores; for(std::vector<App42Score>::iterator it = scores.begin(); it != scores.end(); ++it) { printf("\n CreatedOn=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); printf("\n Facebook User Name = %s",it->facebookProfile.getName().c_str()); printf("\n Facebook Id = %s",it->facebookProfile.getFbId().c_str()); printf("\n Facebook Picture URL = %s",it->facebookProfile.getPicture().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; DateTime startDate = null; /* Get date from your source */ DateTime endDate = null; /* Get date from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetTopNRankersFromFacebook(gameName, accessToken, startDate, endDate, max); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score value is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); Console.WriteLine("Created On : " + game.GetScoreList()[i].GetCreatedOn()); Console.WriteLine("Facebook id is : " + game.GetScoreList()[i].GetFacebookProfile().GetId()); Console.WriteLine("Facebook name is : " + game.GetScoreList()[i].GetFacebookProfile().GetName()); Console.WriteLine("Facebook picture is : " + game.GetScoreList()[i].GetFacebookProfile().GetPicture()); }$gameName = "<Enter_your_game_name>"; $accessToken = "<Enter_facebook_access_token>"; $max = 2; $startDate = null; /* Get date from your source */ $endDate = null; /* Get date from your source */ App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $game = $scoreBoardService->getTopNRankersFromFacebookByDateRange($gameName, $accessToken,$startDate ,$endDate,$max); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); print_r("Friend Name:" . $score->getFacebookProfile()->getName()); print_r("Id :" . $score->getFacebookProfile()->getId()); print_r("Picture Url: " . $score->getFacebookProfile()->getPicture()); }const char* gameName = "<Enter_your_game_name>"; const char* fbAccessToken = "<Enter_facebook_access_token>"; int max = 5; tm start_date = nullptr; /* Get date from your source */; tm end_date = nullptr; /* Get date from your source */; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetTopNRankersFromFacebook(gameName, fbAccessToken, &start_date, &end_date, max, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { vector<App42Score> scores = scoreResponse->scores; for(std::vector<App42Score>::iterator it = scores.begin(); it != scores.end(); ++it) { printf("\n CreatedOn=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); printf("\n Facebook User Name = %s",it->facebookProfile.getName().c_str()); printf("\n Facebook Id = %s",it->facebookProfile.getFbId().c_str()); printf("\n Facebook Picture URL = %s",it->facebookProfile.getPicture().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String="<Enter_your_game_name>"; var accessToken:String="<Enter_facebook_access_token>"; var max:int= 5; var startDate:Date = null; /* Get date from your source */ var endDate:Date = null; /* Get date from your source */ App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getTopNRankersFromFacebookByDateRange(gameName, accessToken ,startDate,endDate, max , new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var facebookProfile:FacebookProfile; if(response is Game) { var score:Score = new Score(); var gameResponse:Game = Game(response); trace("GameName is : " + gameResponse.getName()); for(var l:int =0;l<gameResponse.getScoreList().length;l++) { score = Score(gameResponse.getScoreList()[l]); trace("username " +score.getUserName()); trace("value " +score.getValue()); trace("scoreId " +score.getScoreId()); trace("created on"+score.getCreatedOn()); facebookProfile = FacebookProfile(score.getFacebookList()[l]); trace("FB Id is : " + facebookProfile.getId()); trace("FB Name is : " + facebookProfile.getName()); trace("FB Picture is : " + facebookProfile.getPicture()); } } } public function onException(excption:App42Exception):void { outputField.text += "" + excption; } }Not AvailableString gameName = "<Enter_your_game_name>"; String accessToken = "<Enter_facebook_access_token>"; int max = 2; Date startDate = null; /* Get date from your source */ Date endDate = null; /* Get date from your source */ App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game score = scoreBoardService.getTopNRankersFromFacebook(gameName, accessToken,startDate,endDate, max); for(int i=0;i<score.getScoreList().size();i++) { System.out.println("UserName is:"+ ((Game.Score)score.getScoreList().elementAt(i)).getUserName()); System.out.println("Value is "+((Game.Score)score.getScoreList().elementAt(i)).getValue()); System.out.println("ScoreId is: "+ ((Game.Score)score.getScoreList().elementAt(i)).getScoreId()); System.out.println("Created On is: "+((Game.Score)score.getScoreList().elementAt(i)).getCreatedOn()); System.out.println("Facebook id is :"+ ((Game.Score)score.getScoreList().elementAt(i)).getFacebookProfile().getId()); System.out.println("Facebook friend name is "+ ((Game.Score)score.getScoreList().elementAt(i)).getFacebookProfile().getName()); System.out.println("Facebook picture url is "+ ((Game.Score)score.getScoreList().elementAt(i)).getFacebookProfile().getPicture()); }
Save additional data of user along with score in JSON format. One can fetch these saved information back in leaderboard along with score. See <Fetch Additional data in leaderbaord>
Required Parameters
collectionName - Name of the collection under which JSON doc needs to be saved.
jsonDoc - Target JSON document to be saved.
String gameName = "<Enter_your_game_name>"; String userName = "Nick"; BigDecimal gameScore = new BigDecimal(3500); String dbName = "<Your_DataBase_Name>"; String collectionName = "<Your_Collection_Name>"; JSONObject jsonDoc = new JSONObject(); jsonDoc.put("name","John"); jsonDoc.put("age",20); App42API.setDbName(dbName); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.addJSONObject( collectionName, jsonDoc); scoreBoardService.saveUserScore(gameName, userName, gameScore,new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); for (int j = 0; j < game.getScoreList().get(i).getJsonDocList().size(); j++) { System.out.println("owner is "+ game.getScoreList().get(i).getJsonDocList().get(j).getOwner()); System.out.println("Doc id is "+ game.getScoreList().get(i).getJsonDocList().get(j).getDocId()); System.out.println("updated at "+ game.getScoreList().get(i).getJsonDocList().get(j).getUpdatedAt()); System.out.println("created at "+ game.getScoreList().get(i).getJsonDocList().get(j).getCreatedAt()); System.out.println("json doc is : "+ game.getScoreList().get(i).getJsonDocList().get(j).getJsonDoc()); } } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; String userName = "Nick"; double gameScore = 3500; String dbName = "<Your_DataBase_Name>"; String collectionName = "<Your_Collection_Name>"; JObject jsonDoc = new JObject(); jsonDoc.Add("name","John"); jsonDoc.Add("age",20); App42API.SetDbName(dbName); App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.AddJSONObject(collectionName, jsonDoc); scoreBoardService.SaveUserScore(gameName,userName,gameScore,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); Console.WriteLine("owner is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetOwner()); Console.WriteLine("Doc id is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetDocId()); Console.WriteLine("updated at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetUpdatedAt()); Console.WriteLine("created at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetCreatedAt()); Console.WriteLine("json doc is : "+ game.GetScoreList()[i].GetJsonDocList()[0].GetJsonDoc()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; double gameScore = 3500; NSString *dbName = @"<Your_DataBase_Name>"; NSString *collectionName = @"<Your_Collection_Name>"; NSDictionary *otherScoreInfo = [NSDictionary dictionaryWithObjectsAndKeys:@"John",@"name",@"20",@"age",nil]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [App42API setDbName:dbName]; [scoreBoardService addCustomScore:otherScoreInfo collectionName:collectionName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSLog(@"response is = %@", responseObj); } else { NSLog(@"Exception = %@",[exception reason]); } }]; [scoreBoardService saveUserScore:gameName gameUserName:userName gameScore:gameScore completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); for (JSONDocument *doc in score.jsonDocArray) { NSLog(@"CreatedAt=%@",doc.createdAt); NSLog(@"UpdatedAt=%@",doc.updatedAt); NSLog(@"DocId=%@",doc.docId); NSLog(@"Owner=%@",doc.owner); NSLog(@"Doc=%@",doc.jsonDoc); } } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];coming soonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; BigDecimal gameScore = new BigDecimal(3500); String dbName = "<Your_DataBase_Name>"; String collectionName = "<Your_Collection_Name>"; JSONObject jsonDoc = new JSONObject(); jsonDoc.put("name","John"); jsonDoc.put("age",20); App42API.setDbName(dbName); scoreBoardService.addJSONObject( collectionName, jsonDoc); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.saveUserScore(gameName,userName,gameScore); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); for (int j = 0; j < game.getScoreList().get(i).getJsonDocList().size(); j++) { System.out.println("owner is "+ game.getScoreList().get(i).getJsonDocList().get(j).getOwner()); System.out.println("Doc id is "+ game.getScoreList().get(i).getJsonDocList().get(j).getDocId()); System.out.println("updated at "+ game.getScoreList().get(i).getJsonDocList().get(j).getUpdatedAt()); System.out.println("created at "+ game.getScoreList().get(i).getJsonDocList().get(j).getCreatedAt()); System.out.println("json doc is : "+ game.getScoreList().get(i).getJsonDocList().get(j).getJsonDoc()); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; double gameScore = 3500; String dbName = "<Your_DataBase_Name>"; String collectionName = "<Your_Collection_Name>"; Dictionary<string, object> jsonDoc = new Dictionary<string, object> (); jsonDoc.Add("name","John"); jsonDoc.Add("age",20); App42API.SetDbName(dbName); scoreBoardService.AddJSONObject(collectionName, jsonDoc); App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.SaveUserScore(gameName, userName, gameScore, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); App42Log.Console("owner is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetOwner()); App42Log.Console("Doc id is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetDocId()); App42Log.Console("updated at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetUpdatedAt()); App42Log.Console("created at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetCreatedAt()); App42Log.Console("json doc is : "+ game.GetScoreList()[i].GetJsonDocList()[0].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", userName = "Nick", gameScore = 3500, result ; var dbName = "<Your_DataBase_Name>"; var collectionName = "<Your_Collection_Name>"; var jsonDoc = new Object(); jsonDoc.name = "Nick"; jsonDoc.type = "30"; App42.setDbName(dbName); App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.addJSONObject(collectionName,jsonDoc); scoreBoardService.saveUserScore(gameName,userName,gameScore,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; console.log("userName is : " + scoreList.userName); console.log("scoreId is : " + scoreList.scoreId); console.log("value is : " + scoreList.value); console.log("Created At:"+scoreList.jsonDoc._$createdAt); console.log("Updated At:"+scoreList.jsonDoc._$updatedAt); console.log("Doc Id is :"+scoreList.jsonDoc._id.$oid); console.log("Owner is : "+scoreList.jsonDoc._$owner.owner); }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local userName = "Nick" local gameScore = 3500 local dbName = "<Your_DataBase_Name>" local collectionName = "<Your_Collection_Name>" local jsonDoc = {} jsonDoc.name = "John" jsonDoc.age = 20 local App42CallBack = {} App42API:setDbName(dbName); App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:addJSONObject( collectionName, jsonDoc); scoreBoardService:saveUserScore(gameName,userName,gameScore,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) print("GetCreatedAt is : "..object:getScoreList():getJsonDocList():getCreatedAt()) print("Doc ID is : "..object:getScoreList():getJsonDocList():getDocId()) print("getUpdatedAt is : "..object:getScoreList():getJsonDocList():getUpdatedAt() ) print("GetJsonDoc is : "..JSON:encode(object:getScoreList():getJsonDocList():getJsonDoc())) 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* dbName = "<Enter_your_database_name>"; const char* collectionName = "<Enter_your_collection_name>"; int gameScore = 3500; App42Object *app42Object = new App42Object(); app42Object->setObject("name", "John"); app42Object->setObject("level", 2); App42API::setDbName(dbName); App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->AddCustomScore(app42Object, collectionName); scoreBoardService->SaveUserScore(gameName, userName, score, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { vector<App42Score> scores = scoreResponse->scores; for(std::vector<App42Score>::iterator it = scores.begin(); it != scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n Rank=%0.0lf\n",it->getRank()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); std::vector<JSONDocument> jsonDocList = it->getJsonDocList(); for(std::vector<JSONDocument>::iterator it1 = jsonDocList.begin(); it1 != jsonDocList.end(); ++it1) { printf("\n CreatedAt=%s",it1->getCreatedAt().c_str()); printf("\n DocId=%s",it1->getDocId().c_str()); printf("\n Owner=%s",it1->getOwner().c_str()); printf("\n UpdatedAt=%s",it1->getUpdatedAt().c_str()); printf("\n JsonDoc=%s\n",it1->getJsonDoc().c_str()); } } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; String userName = "Nick"; double gameScore = 3500; String dbName = "<Your_DataBase_Name>"; String collectionName = "<Your_Collection_Name>"; Dictionary<string, object> jsonDoc = new Dictionary<string, object> (); jsonDoc.Add("name","John"); jsonDoc.Add("age",20); App42API.SetDbName(dbName); App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.AddJSONObject(collectionName, jsonDoc); Game game = scoreBoardService.SaveUserScore(gameName,userName,gameScore); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); Console.WriteLine("owner is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetOwner()); Console.WriteLine("Doc id is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetDocId()); Console.WriteLine("updated at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetUpdatedAt()); Console.WriteLine("created at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetCreatedAt()); Console.WriteLine("json doc is : "+ game.GetScoreList()[i].GetJsonDocList()[0].GetJsonDoc()); }$gameName = "<Enter_your_game_name>"; $userName = "Nick"; $gameScore = 3500; $dbName = "<Your_DataBase_Name>"; $collectionName = "<Your_Collection_Name>"; App42API::setDbName($dbName); $jsonDoc = new JSONObject(); $jsonDoc->put("name", "John"); $jsonDoc->put("age", 20); App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $scoreBoardService->addJSONObject( $collectionName, $jsonDoc); $game = $scoreBoardService->saveUserScore($gameName,$userName,$gameScore); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); $doc = $score->getJsonDocList(); foreach ($doc as $jsonDoc) { print_r("docId is : " . $jsonDoc->getDocId()); print_r("jsonDocs is : " . $jsonDoc->getJsonDoc()); print_r("updated at is : " . $jsonDoc->getUpdatedAt()); print_r("created At is : " . $jsonDoc->getCreatedAt()); } }const char* gameName = "<Enter_your_game_name>"; const char* userName = "<Enter_your_user_name>"; const char* dbName = "<Enter_your_database_name>"; const char* collectionName = "<Enter_your_collection_name>"; int gameScore = 3500; App42Object *app42Object = new App42Object(); app42Object->setObject("name", "John"); app42Object->setObject("level", 2); App42API::setDbName(dbName); App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->AddCustomScore(app42Object, collectionName); scoreBoardService->SaveUserScore(gameName, userName, score, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { vector<App42Score> scores = scoreResponse->scores; for(std::vector<App42Score>::iterator it = scores.begin(); it != scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n Rank=%0.0lf\n",it->getRank()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); std::vector<JSONDocument> jsonDocList = it->getJsonDocList(); for(std::vector<JSONDocument>::iterator it1 = jsonDocList.begin(); it1 != jsonDocList.end(); ++it1) { printf("\n CreatedAt=%s",it1->getCreatedAt().c_str()); printf("\n DocId=%s",it1->getDocId().c_str()); printf("\n Owner=%s",it1->getOwner().c_str()); printf("\n UpdatedAt=%s",it1->getUpdatedAt().c_str()); printf("\n JsonDoc=%s\n",it1->getJsonDoc().c_str()); } } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var userName:String = "userName"; var gameScore:Number = 40000; var dbName:String = "<Your_DataBase_Name>"; var collectionName:String = "<Your_Collection_Name>"; var jsonDoc:Object = new Object; jsonDoc.name = "John"; jsonDoc.age = 30; App42API.setDbName(dbName); App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.addJSONObject( collectionName, jsonDoc); scoreBoardService.saveUserScore(gameName,userName,gameScore, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception : " + excption); } public function onSuccess(response:Object):void { var game:Game = Game(res); var jsonDoc:JSONDocument = new JSONDocument(); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); var jsonDocsList:Array = Score(game.getJsonDocList()[i]); for(var t:int=0; t < jsonDocsList.length;t++) { jsonDoc = JSONDocument(jsonDocsList[t]); trace("Doc ID is : "+ jsonDoc.getDocId()); trace("CreatedAt is : " + jsonDoc.getCreatedAt()); trace("UpdatedAt is : " + jsonDoc.getUpdatedAt()); trace("JsonDoc is : " + jsonDoc.getJsonDoc()); } } } }Coming SoonString gameName = "<Enter_your_game_name>"; String userName = "Nick"; double gameScore = 3500; String dbName = "<Your_DataBase_Name>"; String collectionName = "<Your_Collection_Name>"; JSONObject jsonDoc = new JSONObject(); jsonDoc.put("name","John"); jsonDoc.put("age",20); App42API.setDbName(dbName); scoreBoardService.addJSONObject(collectionName, jsonDoc); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.saveUserScore(gameName,userName,gameScore); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score)scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); System.out.println("Created On is :"+score.getCreatedOn()); MetaResponse.JSONDocument jsonDocument = (MetaResponse.JSONDocument)score.getJsonDocList().elementAt(0); System.out.println("owner is "+ jsonDocument.getOwner()); System.out.println("Doc id is "+ jsonDocument.getDocId()); System.out.println("updated at "+ jsonDocument.getUpdatedAt()); System.out.println("created at "+ jsonDocument.getCreatedAt()); System.out.println("json doc is : "+ jsonDocument.getJsonDoc()); }
Fetche leaderboard along with additional data of user in JSON format. One can pass query object while fetching desired records of user. Null value of query object will return all records of User in given collection.
Required Parameters
gameName - Game name for which top N rankers has to fetch.
max - Max number of rankers to be fetched.
String gameName = "<Enter_your_game_name>"; int max = 2; String key1 = "name"; String value1 = "John"; Query query = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John App42API.setDbName("<Enter_the_dbName>"); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.setQuery("<Your_Collection_Name>", query); scoreBoardService.getTopNRankers(gameName, max, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); for (int j = 0; j < game.getScoreList().get(i).getJsonDocList().size(); j++) { System.out.println("owner is "+ game.getScoreList().get(i).getJsonDocList().get(j).getOwner()); System.out.println("Doc id is "+ game.getScoreList().get(i).getJsonDocList().get(j).getDocId()); System.out.println("updated at "+ game.getScoreList().get(i).getJsonDocList().get(j).getUpdatedAt()); System.out.println("created at "+ game.getScoreList().get(i).getJsonDocList().get(j).getCreatedAt()); System.out.println("json doc is : "+ game.getScoreList().get(i).getJsonDocList().get(j).getJsonDoc()); } } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; int max = 5; String key1 = "name"; String value1 = "John"; Query query = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John App42API.SetDbName("<Enter_the_dbName>"); App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.SetQuery("<Your_Collection_Name>", query); scoreBoardService.GetTopNRankers(gameName, max, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0; i<game.GetScoreList().Count; i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score value is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); Console.WriteLine("Created On : " + game.GetScoreList()[i].GetCreatedOn()); Console.WriteLine("owner is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetOwner()); Console.WriteLine("Doc id is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetDocId()); Console.WriteLine("updated at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetUpdatedAt()); Console.WriteLine("created at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetCreatedAt()); Console.WriteLine("json doc is : "+ game.GetScoreList()[i].GetJsonDocList()[0].GetJsonDoc()); } } }NSString *gameName = @"<Enter_your_game_name>"; NSString *userName = @"Nick"; NSString *key = @"name"; NSString *value = @"John"; int max = 2; NSString *dbName = @"<Your_DataBase_Name>"; NSString *collectionName = @"<Your_Collection_Name>"; Query *query = [QueryBuilder buildQueryWithKey:key value:value andOperator:APP42_OP_EQUALS]; [App42API setDbName:dbName]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService setQuery:collectionName metaInfoQuery:query]; [scoreBoardService getTopNRankers:gameName max:max completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); for (JSONDocument *doc in score.jsonDocArray) { NSLog(@"CreatedAt=%@",doc.createdAt); NSLog(@"UpdatedAt=%@",doc.updatedAt); NSLog(@"DocId=%@",doc.docId); NSLog(@"Owner=%@",doc.owner); NSLog(@"Doc=%@",doc.jsonDoc); } } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];coming soonString gameName = "<Enter_your_game_name>"; int max = 2; String key1 = "name"; String value1 = "John"; Query query = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John App42API.setDbName("<Enter_the_dbName>"); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.setQuery("<Your_Collection_Name>", query); Game game = scoreBoardService.getTopNRankers(gameName, max); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); for (int j = 0; j < game.getScoreList().get(i).getJsonDocList().size(); j++) { System.out.println("owner is "+ game.getScoreList().get(i).getJsonDocList().get(j).getOwner()); System.out.println("Doc id is "+ game.getScoreList().get(i).getJsonDocList().get(j).getDocId()); System.out.println("updated at "+ game.getScoreList().get(i).getJsonDocList().get(j).getUpdatedAt()); System.out.println("created at "+ game.getScoreList().get(i).getJsonDocList().get(j).getCreatedAt()); System.out.println("json doc is : "+ game.getScoreList().get(i).getJsonDocList().get(j).getJsonDoc()); } }String gameName = "<Enter_your_game_name>"; int max = 5; String key1 = "name"; String value1 = "John"; Query query = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John App42API.SetDbName("<Enter_the_dbName>"); App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.SetQuery("<Your_Collection_Name>", query); App42Log.SetDebug(true); //Print output in your editor console scoreBoardService.GetTopNRankers(gameName, max, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i < game.GetScoreList().Count; i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score value is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); App42Log.Console("Created On : " + game.GetScoreList()[i].GetCreatedOn()); App42Log.Console("owner is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetOwner()); App42Log.Console("Doc id is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetDocId()); App42Log.Console("updated at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetUpdatedAt()); App42Log.Console("created at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetCreatedAt()); App42Log.Console("json doc is : "+ game.GetScoreList()[i].GetJsonDocList()[0].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>"; var max = 5; var dbName = "<Your_DataBase_Name>"; var collectionName = "<Your_Collection_Name>"; var key1 = "name"; var value1 = "John"; var queryBuilder = new QueryBuilder(); var query = queryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John App42.initialize("API_KEY","SECRET_KEY"); App42.setDbName(dbName); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.setQuery(collectionName, query); scoreBoardService.getTopNRankers(gameName, max, { success: function (object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName); console.log("scoreId is : " + scoreList[i].scoreId); console.log("value is : " + scoreList[i].value); if (scoreList[i].jsonDoc.length > 0) { console.log("Created At:" + scoreList[i].jsonDoc._$createdAt); console.log("Updated At:" + scoreList[i].jsonDoc._$updatedAt); console.log("Doc Id is :" + scoreList[i].jsonDoc._id.$oid); console.log("Owner is : " + scoreList[i].jsonDoc._$owner.owner); } } } else { console.log("userName is : " + scoreList.userName); console.log("scoreId is : " + scoreList.scoreId); console.log("value is : " + scoreList.value); if (scoreList.jsonDoc.length > 0) { console.log("Created At:" + scoreList.jsonDoc._$createdAt); console.log("Updated At:" + scoreList.jsonDoc._$updatedAt); console.log("Doc Id is :" + scoreList.jsonDoc._id.$oid); console.log("Owner is : " + scoreList.jsonDoc._$owner.owner); } } }, error: function (error) { } });local gameName = "<Enter_your_game_name>" local max = 5 local key1 = "name" local value1 = "John" local query = queryBuilder:build(key1, value1, Operator.EQUALS) App42API:setDbName("<Enter_the_dbName>"); scoreBoardService:setQuery("<Your_Collection_Name>",query); local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:getTopNRankers(gameName,max,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) if table.getn(object:getScoreList()) > 1 then for i=1,table.getn(object:getScoreList()) do print("userName is : "..object:getScoreList()[i]:getUserName()) print("score is : "..object:getScoreList()[i]:getValue()) print("scoreId is : "..object:getScoreList()[i]:getScoreId()) for l=1, table.getn(object:getScoreList()[i]:getJsonDocList()) do local jsonDocs = object:getScoreList()[i]:getJsonDocList() print("Doc ID is : "..jsonDocs[l]:getDocId() ) print("getCreatedAt is : "..jsonDocs[l]:getCreatedAt() ) print("getUpdatedAt is : "..jsonDocs[l]:getUpdatedAt() ) end end else print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) print("GetCreatedAt is : "..object:getScoreList():getJsonDocList():getCreatedAt()) print("Doc ID is : "..object:getScoreList():getJsonDocList():getDocId()) print("getUpdatedAt is : "..object:getScoreList():getJsonDocList():getUpdatedAt() ) print("GetJsonDoc is : "..JSON:encode(object:getScoreList():getJsonDocList():getJsonDoc())) 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* dbName = "<Enter_your_database_name>"; const char* collectionName = "<Enter_your_collection_name>"; int max = 2; const char* key = "name"; const char* value = "John"; App42API::setDbName(dbName); Query *query = QueryBuilder::BuildQuery(key, value, APP42_OP_EQUALS); App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->setQuery(collectionName, query); scoreBoardService->GetTopNRankers(gameName, max, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { vector<App42Score> scores = scoreResponse->scores; for(std::vector<App42Score>::iterator it = scores.begin(); it != scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n Rank=%0.0lf\n",it->getRank()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); std::vector<JSONDocument> jsonDocList = it->getJsonDocList(); for(std::vector<JSONDocument>::iterator it1 = jsonDocList.begin(); it1 != jsonDocList.end(); ++it1) { printf("\n CreatedAt=%s",it1->getCreatedAt().c_str()); printf("\n DocId=%s",it1->getDocId().c_str()); printf("\n Owner=%s",it1->getOwner().c_str()); printf("\n UpdatedAt=%s",it1->getUpdatedAt().c_str()); printf("\n JsonDoc=%s\n",it1->getJsonDoc().c_str()); } } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; int max = 2; String key1 = "name"; String value1 = "John"; Query query = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John App42API.SetDbName("<Enter_the_dbName>"); scoreBoardService.SetQuery("<Your_Collection_Name>", query); App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); Game game = scoreBoardService.GetTopNRankers(gameName, max); Console.WriteLine("Game Name is : "+game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score value is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); Console.WriteLine("Created On : " + game.GetScoreList()[i].GetCreatedOn()); Console.WriteLine("owner is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetOwner()); Console.WriteLine("Doc id is "+ game.GetScoreList()[i].GetJsonDocList()[0].GetDocId()); Console.WriteLine("updated at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetUpdatedAt()); Console.WriteLine("created at "+ game.GetScoreList()[i].GetJsonDocList()[0].GetCreatedAt()); Console.WriteLine("json doc is : "+ game.GetScoreList()[i].GetJsonDocList()[0].GetJsonDoc()); }$gameName = "<Enter_your_game_name>"; $max = 2; $key1 = "name"; $value1 = "John"; $queryBuilder = new QueryBuilder(); App42API::setDbName("<Enter_the_dbName>"); $query = $queryBuilder->build($key1, $value1, Operator::EQUALS); // Build query q1 for key1 equal to name and value1 equal to John App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $scoreBoardService->setQuery("<Your_Collection_Name>", $query); $game = $scoreBoardService->getTopNRankers($gameName, $max); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); $doc = $score->getJsonDocList(); foreach ($doc as $jsonDoc) { print_r("docId is : " . $jsonDoc->getDocId()); print_r("jsonDocs is : " . $jsonDoc->getJsonDoc()); print_r("updated at is : " . $jsonDoc->getUpdatedAt()); print_r("created At is : " . $jsonDoc->getCreatedAt()); } }const char* gameName = "<Enter_your_game_name>"; const char* dbName = "<Enter_your_database_name>"; const char* collectionName = "<Enter_your_collection_name>"; int max = 2; const char* key = "name"; const char* value = "John"; App42API::setDbName(dbName); Query *query = QueryBuilder::BuildQuery(key, value, APP42_OP_EQUALS); App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->setQuery(collectionName, query); scoreBoardService->GetTopNRankers(gameName, max, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { vector<App42Score> scores = scoreResponse->scores; for(std::vector<App42Score>::iterator it = scores.begin(); it != scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n Rank=%0.0lf\n",it->getRank()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); std::vector<JSONDocument> jsonDocList = it->getJsonDocList(); for(std::vector<JSONDocument>::iterator it1 = jsonDocList.begin(); it1 != jsonDocList.end(); ++it1) { printf("\n CreatedAt=%s",it1->getCreatedAt().c_str()); printf("\n DocId=%s",it1->getDocId().c_str()); printf("\n Owner=%s",it1->getOwner().c_str()); printf("\n UpdatedAt=%s",it1->getUpdatedAt().c_str()); printf("\n JsonDoc=%s\n",it1->getJsonDoc().c_str()); } } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String="<Enter_your_game_name>"; var max:int= 5; var key1:String = "name"; var value1:String = "John"; App42API.setDbName("<Enter_the_dbName>"); var query:Query = QueryBuilder.build(key1, value1, Operator.EQUALS); App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.setQuery( "<Your_Collection_Name>", query); scoreBoardService.getTopNRankers(gameName, max , new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception : " + excption); } public function onSuccess(response:Object):void { var game:Game = Game(res); var jsonDoc:JSONDocument = new JSONDocument(); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); var jsonDocsList:Array = Score(game.getJsonDocList()[i]); for(var t:int=0; t < jsonDocsList.length;t++) { jsonDoc = JSONDocument(jsonDocsList[t]); trace("Doc ID is : "+ jsonDoc.getDocId()); trace("CreatedAt is : " + jsonDoc.getCreatedAt()); trace("UpdatedAt is : " + jsonDoc.getUpdatedAt()); trace("JsonDoc is : " + jsonDoc.getJsonDoc()); } } } }Not AvailableString gameName = "<Enter_your_game_name>"; int max = 2; String key1 = "name"; String value1 = "John"; Query query = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John App42API.setDbName("<Enter_the_dbName>"); scoreBoardService.setQuery("<Your_Collection_Name>", query); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getTopNRankers(gameName, max); System.out.println("GameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); System.out.println("Created On is: " + score.getCreatedOn()); MetaResponse.JSONDocument jsonDocument = (MetaResponse.JSONDocument)score.getJsonDocList().elementAt(0); System.out.println("owner is "+ jsonDocument.getOwner()); System.out.println("Doc id is "+ jsonDocument.getDocId()); System.out.println("updated at "+ jsonDocument.getUpdatedAt()); System.out.println("created at "+ jsonDocument.getCreatedAt()); System.out.println("json doc is : "+ jsonDocument.getJsonDoc()); }
This function returns the specified number of top rankers with ascending or descending order in a specific game.
Required Parameters
gameName - Name of the game for which ranks have to be fetched.
max - Maximum number of records to be fetched.
String gameName = "<Enter_your_game_name>"; int max = 10; HashMap<String, String> otherMetaHeaders = new HashMap<String, String>(); otherMetaHeaders.put("orderByAscending", "score");// Use orderByDescending for Descending or orderByAscending for Ascending App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.setOtherMetaHeaders(otherMetaHeaders); scoreBoardService.getTopNRankers(gameName, max, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String gameName = "<Enter_your_game_name>"; int max = 10; Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>(); otherMetaHeaders.Add("orderByAscending", "score");// Use orderByDescending for Descending or orderByAscending for Ascending App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.SetOtherMetaHeaders(otherMetaHeaders); scoreBoardService.GetTopNRankers(gameName,max,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Game game = (Game) response; Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } }NSString *gameName = @"<Enter_your_game_name>"; int max = 10; // Use orderByDescending for Descending or orderByAscending for Ascending NSDictionary *otherMetaHeaders = [NSDictionary dictionaryWithObjectsAndKeys:@"orderByAscending",@"score", nil]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService setOtherMetaHeaders:otherMetaHeaders]; [scoreBoardService getTopNRankers:gameName max:max completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];coming soonString gameName = "<Enter_your_game_name>"; int max = 10; HashMap<String, String> otherMetaHeaders = new HashMap<String, String>(); otherMetaHeaders.put("orderByAscending", "score");// Use orderByDescending for Descending or orderByAscending for Ascending App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.setOtherMetaHeaders(otherMetaHeaders); Game game = scoreBoardService.getTopNRankers(gameName,max); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); }String gameName = "<Enter_your_game_name>"; int max = 10; App42Log.SetDebug(true); //Print output in your editor console Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>(); otherMetaHeaders.Add("orderByAscending", "score");// Use orderByDescending for Descending or orderByAscending for Ascending App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.SetOtherMetaHeaders(otherMetaHeaders); scoreBoardService.GetTopNRankers(gameName, max, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>", max = 10, result ; var otherMetaHeaders={orderByAscending:"score"};//Use orderByDescending for Descending or orderByAscending for Ascending App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.setOtherMetaHeaders(otherMetaHeaders); scoreBoardService.getTopNRankers(gameName,max,{ success: function(object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName) console.log("scoreId is : " + scoreList[i].scoreId) console.log("value is : " + scoreList[i].value) } } else { console.log("userName is : " + scoreList.userName) console.log("scoreId is : " + scoreList.scoreId) console.log("value is : " + scoreList.value) } }, error: function(error) { } });local gameName = "<Enter_your_game_name>" local max = 5 local App42CallBack = {} local otherMetaHeaders = {}; otherMetaHeaders.orderByAscending= "score";//Use orderByDescending for Descending or orderByAscending for Ascending App42API:initialize("API_KEY","SECRET_KEY"); local scoreBoardService = App42API.buildScoreBoardService() scoreBoardService:setOtherMetaHeaders(otherMetaHeaders); scoreBoardService:getTopNRankers(gameName,max,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) if table.getn(object:getScoreList()) > 1 then for i=1,table.getn(object:getScoreList()) do print("userName is : "..object:getScoreList()[i]:getUserName()) print("score is : "..object:getScoreList()[i]:getValue()) print("scoreId is : "..object:getScoreList()[i]:getScoreId()) end else print("userName is : "..object:getScoreList():getUserName()) print("score is : "..object:getScoreList():getValue()) print("scoreId is : "..object:getScoreList():getScoreId()) 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>"; int max =10; map<string,string> otherMetaHeaders; otherMetaHeaders["orderByAscending"] = "score"; // Use orderByDescending for Descending or orderByAscending for Ascending App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->setOtherMetaHeaders(otherMetaHeaders); scoreBoardService->GetTopNRankers(gameName, max, app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }String gameName = "<Enter_your_game_name>"; int max = 10; Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>(); otherMetaHeaders.Add("orderByAscending", "score");// Use orderByDescending for Descending or orderByAscending for Ascending App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.SetOtherMetaHeaders(otherMetaHeaders); Game game = scoreBoardService.GetTopNRankers(gameName,max); Console.WriteLine("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); }$gameName = "<Enter_your_game_name>"; $max = 10; $otherMetaHeaders = array(); $otherMetaHeaders['orderByAscending'] ="score";//Use orderByDescending for Descending or orderByAscending for Ascending App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); $scoreBoardService->setOtherMetaHeaders($otherMetaHeaders); $game = $scoreBoardService->getTopNRankers($gameName,$max); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach ($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); }const char* gameName = "<Enter_your_game_name>"; int max =10; map<string,string> otherMetaHeaders; otherMetaHeaders["orderByAscending"] = "score"; // Use orderByDescending for Descending or orderByAscending for Ascending App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->setOtherMetaHeaders(otherMetaHeaders); scoreBoardService->GetTopNRankers(gameName, max, this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var max:int = 5; var otherMetaHeaders:Dictionary = new Dictionary(); otherMetaHeaders["orderByAscending"] = "score";//Use orderByDescending for Descending or orderByAscending for Ascending App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.setOtherMetaHeaders(otherMetaHeaders); scoreBoardService.getTopNRankers(gameName,max, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Coming SoonString gameName = "<Enter_your_game_name>"; int max = 10; HashMap<String, String> otherMetaHeaders = new HashMap<String, String>(); otherMetaHeaders.put("orderByAscending", "score");// Use orderByDescending for Descending or orderByAscending for Ascending App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.setOtherMetaHeaders(otherMetaHeaders); Game game = scoreBoardService.getTopNRankers(gameName,max); System.out.println("gameName is " + game.getName()); Vector scoreList = game.getScoreList(); for(int i=0;i < scoreList.size();i++) { Game.Score score = (Game.Score) scoreList.elementAt(i); System.out.println("userName is " + score.getUserName()); System.out.println("value is " + score.getValue()); System.out.println("scoreId is " + score.getScoreId()); }
Fetch the users between specific score range.
Required Parameters
gameName - Name of the game for which users have to be fetched.
minScore - Minimum score from which the users have to be fetched.
maxScore - Maximum score up to which the users have to be fetched.
String gameName = "<Enter_your_game_name>"; BigDecimal minScore = new BigDecimal(100); BigDecimal maxScore = new BigDecimal(3500); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getUsersWithScoreRange(gameName, minScore, maxScore, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Coming SoonNSString *gameName = @"<Enter_your_game_name>"; double minScore = 100; double maxScore = 3500; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; ScoreBoardService *scoreBoardService = [App42API buildScoreBoardService]; [scoreBoardService getUsersWithScoreRange:gameName minScore:minScore maxScore:maxScore completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); NSMutableArray *scoreList = game.scoreList; for(Score *score in scoreList) { NSLog(@"User Name is = %@",score.userName); NSLog(@"Value is = %f",score.value); NSLog(@"scoreId is = %@",score.scoreId); } } 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 gameName = "<Enter_your_game_name>" let minScore:Double = 10let maxScore:Double = 5000 App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") var scoreBoardService = App42API.buildScoreBoardService() as? ScoreBoardService scoreBoardService?.getUsersWithScoreRange(gameName, minScore:minScore, maxScore:maxScore, completionBlock: { (success, response, exception) -> Void in if(success) { let game = response as! Game NSLog("gameName is %@", game.name) NSLog("gameDescription is %@", game.description) var scoreList = game.scoreList for score in scoreList { NSLog("userName is %@", score.userName) var scoreValue = score.value as Double NSLog("score is %lf",scoreValue) NSLog("scoreId is %@", score.scoreId) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String gameName = "<Enter_your_game_name>"; BigDecimal minScore = new BigDecimal(100); BigDecimal maxScore = new BigDecimal(3500); App42API.initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.buildScoreBoardService(); Game game = scoreBoardService.getUsersWithScoreRange(gameName, minScore, maxScore); System.out.println("Game Name is : "+game.getName()); for(int i = 0;i<game.getScoreList().size();i++) { System.out.println("userName is : " + game.getScoreList().get(i).getUserName()); System.out.println("score is : " + game.getScoreList().get(i).getValue()); System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId()); System.out.println("Created On is :"+game.getScoreList().get(i).getCreatedOn()); }String gameName = "<Enter_your_game_name>"; Double minScore = 10; Double maxScore = 3500; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetUsersWithScoreRange(gameName, minScore, maxScore); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game) response; App42Log.Console("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var gameName = "<Enter_your_game_name>"; var minScore = 10; var maxScore = 3500; App42.initialize("API_KEY","SECRET_KEY"); var scoreBoardService = new App42ScoreBoard(); scoreBoardService.getUsersWithScoreRange(gameName, minScore, maxScore, { success: function (object) { var game = JSON.parse(object); result = game.app42.response.games.game; console.log("gameName is : " + result.name) var scoreList = result.scores.score; if (scoreList instanceof Array) { for (var i = 0; i < scoreList.length; i++) { console.log("userName is : " + scoreList[i].userName); console.log("scoreId is : " + scoreList[i].scoreId); console.log("value is : " + scoreList[i].value); } } else { console.log("userName is : " + scoreList.userName); console.log("scoreId is : " + scoreList.scoreId); console.log("value is : " + scoreList.value); } }, error: function (error) { } });Coming Soonconst char* gameName = "<Enter_your_game_name>"; double minScore =1000; double maxScore =1200; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetUsersWithScoreRange(gameName, minScore, maxScore,app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onScoreBoardRequestCompleted(void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soon$gameName = "<Enter_your_game_name>"; $minScore = 100; $maxScore = 3500; App42API.Initialize("API_KEY","SECRET_KEY"); App42API::initialize("API_KEY","SECRET_KEY"); $scoreBoardService = App42API::buildScoreBoardService(); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); $game = $scoreBoardService->getUsersWithScoreRange($gameName,$minScore,$maxScore); print_r("gameName is " . $game->getName()); $scoreList = $game->getScoreList(); foreach($scoreList as $score) { print_r("User Name is " . $score->getUserName()); print_r("Value is " . $score->getValue()); print_r("scoreId is : " . $score->getScoreId()); print_r("Created On is :" . $score->getCreatedOn()); } $jsonResponse = $game->toString();const char* gameName = "<Enter_your_game_name>"; double minScore =1000; double maxScore =1200; App42API::Initialize("API_KEY", "SECRET_KEY"); ScoreBoardService *scoreBoardService = App42API::BuildScoreBoardService(); scoreBoardService->GetUsersWithScoreRange(gameName, minScore, maxScore,this, app42callfuncND_selector(Sample_Class::onScoreBoardRequestCompleted)); void Sample_Class::onScoreBoardRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *scoreResponse = (App42GameResponse*)response; printf("\ncode=%d",scoreResponse->getCode()); printf("\nResponse Body=%s",scoreResponse->getBody().c_str()); if (scoreResponse->isSuccess) { for(std::vector<App42Score>::iterator it = scoreResponse->scores.begin(); it != scoreResponse->scores.end(); ++it) { printf("\n CreatedAt=%s",it->getCreatedOn().c_str()); printf("\n ScoreId=%s\n",it->getScoreId().c_str()); printf("\n ScoreValue=%f\n",it->getScoreValue()); printf("\n UserName=%s\n",it->getUserName().c_str()); } } else { printf("\nerrordetails:%s",scoreResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",scoreResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",scoreResponse->appErrorCode); printf("\nhttpErrorCode:%d",scoreResponse->httpErrorCode); } }Coming Soonvar gameName:String = "<Enter_your_game_name>"; var minScore:Number = 100; var maxScore:Number = 3500; App42API.initialize("API_KEY","SECRET_KEY"); var scoreBoardService:ScoreBoardService = App42API.buildScoreBoardService(); scoreBoardService.getUsersWithScoreRange(gameName,minScore,maxScore, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception : " + excption); } public function onSuccess(response:Object):void { var game:Game = Game(res); trace("gameName is : " + game.getName()); for(var i:int=0;i<game.getScoreList().length;i++) { trace("username is : " + Score(game.getScoreList()[i]).getUserName()); trace("value is : " + Score(game.getScoreList()[i]).getValue()); trace("created on : "+ Score(game.getScoreList()[i]).getCreatedOn()); trace("scoreId is : " + Score(game.getScoreList()[i]).getScoreId()); } } }Not AvailableComing Soon
The functions available under Gaming API can throw some exceptions in abnormal conditions. For example, if a developer is creating a game with name which is already in database, the function will throw the App42Exception (as shown below) with message as “Bad Request” and the appErrorCode as “3000” and the details as “The request parameters are invalid. Game with the name ‘gameName’ already exists”.
String gameName = "<Enter_your_game_name>"; String description = "description"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); gameService.createGame(gameName, description, new App42CallBack() { public void onSuccess(Object response) { Game game = (Game)response; System.out.println("gameName is " + game.getName()); System.out.println("gameDescription is " + game.getDescription()); } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = exception.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ } });String gameName = "<Enter_your_game_name>"; String description = "description"; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.createGame(gameName,description, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = exception.GetMessage(); /* returns the Exception text in JSON format. (as shown below)*/ } public void OnSuccess(Object response) { Game game = (Game) response; } }NSString *gameName = @"<Enter_your_game_name>"; NSString *description = @"description"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; GameService *gameService = [App42API buildGameService]; [gameService createGame:gameName gameDescription:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Game *game = (Game*)responseObj; NSLog(@"gameName is = %@", game.name); } else { int appErrorCode = exception.appErrorCode; int httpErrorCode = exception.httpErrorCode; if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } NSString *jsonText = exception.reason; /* returns the Exception text in JSON format. (as shown below)*/ } }];coming soonString gameName = "<Enter_your_game_name>"; String description = "description"; App42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); try { Game game = gameService.createGame(gameName,description); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = exception.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ }String gameName = "<Enter_your_game_name>"; String description = "<Description>"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); gameService.CreateGame(gameName,description, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = exception.GetMessage(); /* returns the Exception text in JSON format. (as shown below)*/ } public void OnSuccess(object response) { App42Log.Console("response is : " + response.ToString()); } }var gameName = "<Enter_your_game_name>", var description = "description"; App42.initialize("API_KEY","SECRET_KEY"); var gameService = new App42Game(); gameService.createGame(gameName,description,{ success: function(object) { }, error: function(error) { var userObj = JSON.parse(error); appErrorCode = userObj.app42Fault.appErrorCode; if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } } });local gameName = "<Enter_your_game_name>" local description = "description" local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY"); local gameService = App42API.buildGameService() gameService:createGame(gameName,description,App42CallBack) function App42CallBack:onSuccess(object) print("Game name is "..object:getName()) print("Description is "..object:getDescription()) end function App42CallBack:onException(exception) local appErrorCode = exception:getAppErrorCode() if appErrorCode == 3000 then -- Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) elseif appErrorCode == 1401 then -- handle here for Client is not authorized elseif appErrorCode == 1500 then -- handle here for Internal Server Error end endconst char* gameName = "<Enter_your_game_name>"; const char* description = "Description"; App42API::Initialize("API_KEY", "SECRET_KEY"); GameService *gameService = App42API::BuildGameService(); gameService->CreateGame(gameName, description,app42callback(Sample_Class::onScoreBoardRequestCompleted, this)); void Sample_Class::onGameRequestCompleted(void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { //Handle success response. } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); int appErrorCode = gameResponse->appErrorCode; if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } } }String gameName = "<Enter_your_game_name>"; String description = "description"; App42API.Initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.BuildGameService(); try { Game game = gameService.CreateGame(gameName,description); } catch(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = exception.GetMessage(); /* returns the Exception text in JSON format. (as shown below)*/ }$gameName = "<Enter_your_game_name>"; $description = "description"; App42API::initialize("API_KEY","SECRET_KEY"); $gameService = App42API::buildGameService(); try { $game = $gameService->createGame($gameName,$description); } catch(App42Exception $ex) { $appErrorCode = $ex->getAppErrorCode(); $httpErrorCode = $ex->getHttpErrorCode(); if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } $jsonText = $ex->getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ }const char* gameName = "<Enter_your_game_name>"; const char* description = "Description"; App42API::Initialize("API_KEY", "SECRET_KEY"); GameService *gameService = App42API::BuildGameService(); gameService->CreateGame(gameName, description, this, app42callfuncND_selector(Sample_Class::onGameRequestCompleted)); void Sample_Class::onGameRequestCompleted(App42CallBack *sender, void *response) { App42GameResponse *gameResponse = (App42GameResponse*)response; printf("\ncode=%d",gameResponse->getCode()); printf("\nResponse Body=%s",gameResponse->getBody().c_str()); if (gameResponse->isSuccess) { //Handle success response. } else { printf("\nerrordetails:%s",gameResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",gameResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",gameResponse->appErrorCode); printf("\nhttpErrorCode:%d",gameResponse->httpErrorCode); int appErrorCode = gameResponse->appErrorCode; if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } } }Coming SoonComing SoonComing SoonString gameName = "<Enter_your_game_name>"; String description = "description"; App42API.initialize("API_KEY","SECRET_KEY"); GameService gameService = App42API.buildGameService(); try { Game game = gameService.createGame(gameName,description); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 3000) { // Handle here for Bad Request (The request parameters are invalid. Game with the name 'gameName' already exists.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = exception.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ }
Functions in Game API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The Request parameters are invalid.
1401 - UNAUTHORIZED - Client is not authorized.
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again.
3000 - BAD REQUEST - The request parameters are invalid. Game with the name '@name' already exists.
3001 - NOT FOUND - Games do not exist.
3002 - NOT FOUND - Game with the name '@name' does not exist.
3003 - NOT FOUND - Scores for the game '@name' does not exist.
3004 - BAD REQUEST - The request parameters are invalid. Reward with the name '@rewardName' already exists.
3005 - NOT FOUND - Rewards do not exist.
3006 - NOT FOUND - Reward with the name '@name' does not exist.
3007 - NOT FOUND - User with the name '@userName' does not exist.
3008 - BAD REQUEST - The request parameters are invalid. Do not have enough reward points to redeem.
3009 - BAD REQUEST - The request parameters are invalid. Do not have enough scores to deduct.
3010 - NOT FOUND - Scores for the user with the name '@userName' for the game with the name '@name' do not exist.
3011 - NOT FOUND - The number of games are less than the specified offset : "offset".
3012 - NOT FOUND - The number of rewards are less than the specified offset : "offset".
3013 - NOT FOUND - Scores for the game with the name '@name' does not exist.
3014 - NOT FOUND - Reward Points for the user with the name '@userName' do not exist.
3015 - NOT FOUND - Scores between startDate '@startDate' and endDate '@endDate' for the game with the name '@name' does not exist.
3016 - NOT FOUND - Scores with users '@userList' for the game with the name '@name' does not exist.
3017 - NOT FOUND - User name '@userName' does not exist.
3018 - NOT FOUND - Reward Points for the reward with the name '@rewardName' do not exist.
3019 - NOT FOUND - Reward Points for the users do not exist.
3020 - NOT FOUND - Score Id '@scoreId' does not exist.
3021 - NOT FOUND - Scores betweem startDate '@startDate' and endDate '@endDate' does not exist.
3022 - NOT FOUND - Group by the name '@groupName' for user '@ownerName' does not exists.'
3023 - NOT FOUND - Group by the name '@groupName' friends does not exists.'
3024 - NOT FOUND - User by the name '@userName' friends does not exists.'
3025 - BAD REQUEST - The Facebook Access Credentials are invalid.+ <Received Facebook Exception Message>.
3026 - NOT FOUND - Scores with friends for the game with the name '${name}' does not exist.
3027 - NOT FOUND - Scores betweem startDate '@startDate' and endDate '@endDate' with friends for the game name '@name' does not exist.