LeaderboardsEntriesRequest

Get the leaderboard entry data for the current player or a given player.

For each leaderboard it returns the array of leaderboard entries that the player has.

View interactive version here

Request Parameters

Parameter Required Type Description
challenges No string[] The challenge leaderboards to return entries for
inverseSocial No boolean Returns the leaderboard excluding the player's social friends
leaderboards No string[] The list of leaderboards shortcodes
player No string The player id. Leave out to use the current player id
social No boolean Set to true to include the player's game friends
teamTypes No string[] The types of team to apply this request to

Response Parameters

A response containing leaderboard entry data for a given player. The response will contain one key for every leaderboard in the result. Example response:

{"HS": [{"userId":"537f08e1e4b01fdedfa52c49","SCORE": 123,"city":"York","country":"GB","userName":"","when":"2014-07-17T12:18Z","rank": 1  }]}

Parameter Type Description
scriptData ScriptData A JSON Map of any data added either to the Request or the Response by your Cloud Code

Nested types

ScriptData

A collection of arbitrary data that can be added to a message via a Cloud Code script.

Parameter Type Description
myKey string An arbitrary data key
myValue JSON An arbitrary data value.

Code Samples

C#

    using GameSparks.Api;
    using GameSparks.Api.Requests;
    using GameSparks.Api.Responses;
    ...
    new LeaderboardsEntriesRequest()
        .SetChallenges(challenges)
        .SetInverseSocial(inverseSocial)
        .SetLeaderboards(leaderboards)
        .SetPlayer(player)
        .SetSocial(social)
        .SetTeamTypes(teamTypes)
        .Send((response) => {
        GSData scriptData = response.ScriptData; 
        });

ActionScript 3

    import com.gamesparks.*;
    import com.gamesparks.api.requests.*;
    import com.gamesparks.api.responses.*;
    import com.gamesparks.api.types.*;
    ...

    gs.getRequestBuilder()
        .createLeaderboardsEntriesRequest()
        .setChallenges(challenges)
        .setInverseSocial(inverseSocial)
        .setLeaderboards(leaderboards)
        .setPlayer(player)
        .setSocial(social)
        .setTeamTypes(teamTypes)
        .send(function(response:com.gamesparks.api.responses.LeaderboardsEntriesResponse):void {
        var scriptData:ScriptData = response.getScriptData(); 
        });

Objective-C

    #import "GS.h"
    #import "GSAPI.h"
    ...
    GSLeaderboardsEntriesRequest* request = [[GSLeaderboardsEntriesRequest alloc] init];
    [request setChallenges:challenges;
    [request setInverseSocial:inverseSocial;
    [request setLeaderboards:leaderboards;
    [request setPlayer:player;
    [request setSocial:social;
    [request setTeamTypes:teamTypes;
    [request setCallback:^ (GSLeaderboardsEntriesResponse* response) {
    NSDictionary* scriptData = [response getScriptData]; 
    }];
    [gs send:request];

C++


    #include <GameSparks/generated/GSRequests.h>
    using namespace GameSparks::Core;
    using namespace GameSparks::Api::Responses;
    using namespace GameSparks::Api::Requests;
    ...

    void LeaderboardsEntriesRequest_Response(GS& gsInstance, const LeaderboardsEntriesResponse& response) {
    GSData scriptData = response.getScriptData(); 
    }
    ......

    LeaderboardsEntriesRequest request(gsInstance);
    request.SetChallenges(challenges)
    request.SetInverseSocial(inverseSocial)
    request.SetLeaderboards(leaderboards)
    request.SetPlayer(player)
    request.SetSocial(social)
    request.SetTeamTypes(teamTypes)
    request.Send(LeaderboardsEntriesRequest_Response);

Java

import com.gamesparks.sdk.api.autogen.GSRequestBuilder.LeaderboardsEntriesRequest;
import com.gamesparks.sdk.api.autogen.GSResponseBuilder.LeaderboardsEntriesResponse;
import com.gamesparks.sdk.api.autogen.GSTypes.*;
import com.gamesparks.sdk.api.GSEventListener;

...
gs.getRequestBuilder().createLeaderboardsEntriesRequest()
    .setChallenges(challenges)
    .setInverseSocial(inverseSocial)
    .setLeaderboards(leaderboards)
    .setPlayer(player)
    .setSocial(social)
    .setTeamTypes(teamTypes)
    .send(new GSEventListener<LeaderboardsEntriesResponse>() {
        @Override
        public void onEvent(LeaderboardsEntriesResponse response) {
            GSData scriptData = response.getScriptData(); 
        }
    });

Cloud Code


    var request = new SparkRequests.LeaderboardsEntriesRequest();
    request.challenges = ...;
    request.inverseSocial = ...;
    request.leaderboards = ...;
    request.player = ...;
    request.social = ...;
    request.teamTypes = ...;
    var response = request.Send();

var scriptData = response.scriptData; 
Did this page help you? Please enter your feedback below. For questions about using this part of the platform, please contact support here