Gigya Job Openings

gm.getTopUsers REST

Skip to end of metadata
Go to start of metadata

Note: If you plan on integrating the Loyalty platform, we highly recommend reading the Loyalty - Gamification and User Behavior Guide. Loyalty is a premium Gigya platform that requires separate activation. If it is not yet a part of your existing site package, please contact Gigya Support via the Support link in the top menu of your Console Dashboard or email support@gigya.com.

Description

This API returns the top ranked users for a specified challenge. This method may be used for displaying a leaderboard of a challenge. Only users who have a name, email or provider will be returned.

 

Request URL


Where <Data_Center> is:
  • us1.gigya.com - For the US data center.
  • eu1.gigya.com - For the European data center.
  • au1.gigya.com - For the Australian data center.
  • ru1.gigya.com - For the Russian data center.
  • cn1.gigya-api.cn - For the Chinese data center.

If you are not sure of your site's data center, see Finding Your Data Center.

Parameters

RequiredNameTypeDescription
challengestringThe challenge for which to return the top users. By default, if this parameter is not provided, this method will return the top users of the default challenge (challenge='_default').
totalCountnumberThe total number of users to return in the response. The default value is 12, the minimum is 1, and the maximum is 100.
friendsCountnumberThe maximum number of random friends to retrieve. The default value is 3, the minimum is 0, and the maximum is 100.
Note: Fewer friends will be retrieved if the user's friends who are active in the challenge are less than the specified value.
includeSelfBooleanIndicates whether to include the user himself in the list. The default value is 'true'. Setting this parameter to 'true' won't take affect if UID isn't provided.
periodstringThe period for which to get the data. Valid values for this parameter are 'all' and '7days'. The default value is '7days'.
UIDstringThe unique ID of a logged-in user, with which this method call is associated. This is the UID you received from Gigya after successful login of this user.
Setting includeSelf to true won't take affect if UID isn't provided.
If you are using an external OAuth2 SDK then you will need to Pass an Access Token instead of the uid.
actionAttributesJSON objectThis parameter is used to retrieve the top ranked users according to a specific attribute, for example you can retrieve the top users only on the "Glee" page of a site, instead of the top users in the entire site. The action attribute is comprised of a single set of a key (category) and a value, e.g. {"tv-show":"glee"}. In order to use this option, you need to give action attributes to actions the user may perform on the site, such as sharing or commenting, and these action attributes will be used to filter. Read more here.
variantIDstringExplicitly identifies the challenge variant to be used. When specified this parameter will cause the actionAttributes parameter to be ignored.
langstringSpecifies the language of strings to use in the returned text fields, such as badgeURL. If a specific field doesn't have a translation in the requested language, then the string from the default language is used. If this parameter is not specified, then the default language is used. If this field has the special value "all", then each text field is expanded to the object listing all the available languages for that string (the same way it is written to gm.setChallengeConfig).
format string Determines the format of the response. The options are:
  • json (default)
  • jsonp - if the format is jsonp then you are required to define a callback method (see parameter below).
callback string This parameter is required only when the format parameter is set to jsonp (see above). In such cases this parameter should define the name of the callback method to be called in the response, along with the jsonp response data.
context string/JSON This parameter may be used to pass data through the current method and return it, unchanged, within the response.
dontHandleScreenSet Boolean This parameter may be used in order to suppress the showing of screen-sets as a result of API calls. Default is false.
httpStatusCodes Boolean The default value of this parameter is false, which means that the HTTP status code in Gigya's response is always 200 (OK), even if an error occurs. The error code and message is given within the response data (see below). If this parameter is set to true, the HTTP status code in Gigya's response would reflect an error, if one occurred.

Authorization Parameters

Each REST API request must contain identification and authorization parameters.

Some REST APIs may function without these authorization parameters, however, when that occurs, these calls are treated as client-side calls and all client-side rate limits will apply. In order to not reach client-side IP rate limits that may impact your implementation when using server-to-server REST calls, it is Recommended Best Practice to always sign the request or use a secret. A non-exhaustive list of REST APIs that this may apply to are as follows:

  • accounts.login
  • socialize.login
  • accounts.notifyLogin
  • socialize.notifyLogin
  • accounts.finalizeRegistration
  • accounts.linkAccounts

Please refer to the Authorization Parameters section for details. 

 

Response Data

FieldTypeDescription
 
errorCode integer The result code of the operation. Code '0' indicates success, any other number indicates failure. For a complete list of error codes, see the Error Codes table.
errorMessage string A short textual description of an error, associated with the errorCode, for logging purposes. This field will appear in the response only in case of an error.
errorDetails string This field will appear in the response only in case of an error and will contain the exception info, if available.
fullEventName string The full name of the event that triggered the response. This is an internally used parameter that is not always returned and should not be relied upon by your implementation.
callId string Unique identifier of the transaction, for debugging purposes.
time string The time of the response represented in ISO 8601 format, i.e., yyyy-mm-dd-Thh:MM:ss.SSSZ or
statusCode integer The HTTP response code of the operation. Code '200' indicates success.
This property is deprecated and only returned for backward compatibility.
statusReason string A brief explanation of the status code.
This property is deprecated and only returned for backward compatibility.

 

usersarrayAn array listing the top users. Each user is represented by an object that includes the following fields:
  • UID
  • name
  • photoURL
  • rank
    Users with the same number of points are ranked the same.
  • type
    May be 'other', 'friend' or 'self'. 'other' indicates a user who is listed because he is one of the top users for the challenge. 'friend' indicates a user who is listed because he is the current user's friend. 'self' indicates the current user himself.
  • achievements
    List of the user's achievements, including the requested challenge and other challenges in which this user has reached at least level 1.  Each achievement is represented by an object that includes the following fields:
    • challengeID
    • badgeURL - the URL of the image file of the current level's badge.
    • pointsTotal - total accumulated points. This value cannot be less than zero
    • points7Days- points accumulated during the past 7 days. This value cannot be less than zero
    • level - the level that this user reached within this challenge.
    • levelTitle

 

Response Example

{
        "users": [{
            "UID": "000001",
            "name": "David",
            "photoURL": "http://graph.facebook.com/713200989/picture?type=square",
            "rank": 1,
            "type": "self",
            "achievements": [{
                "challengeID": "Challenge_A",
                "badgeURL": "http://a.espncdn.com/i/insider/images/kiperboard/6.jpg",
                "pointsTotal": 255,
                "points7Days": 255,
                "level": 6,
                "levelTitle": "Chal_A_L_6",
                "levelDescription": "Challenge_A_Level_6 Description"},
            {
                "challengeID": "Challenge_B",
                "badgeURL": "http://assets.espn.go.com/i/mag/blog/2011/lawNum/bold/4.jpg",
                "pointsTotal": 400,
                "points7Days": 400,
                "level": 4,
                "levelTitle": "Chal_B_L_4",
                "levelDescription": "Challenge_B_Level_4 Description"},
            {
                "challengeID": "_default",
                "badgeURL": "http://cdn.gigya.com/gs/i/GMBadges/Expert.png",
                "pointsTotal": 3195,
                "points7Days": 3195,
                "level": 3,
                "levelTitle": "Expert",
                "levelDescription": "Earn points for all of the actions you take on the site..."}]},
        {
            "UID": "0000002",
            "name": "Joe",
            "photoURL": "http://a3.twimg.com/profile_images/220397777/i710117c_1__normal.jpg",
            "rank": 2,
            "type": "friend",
            "achievements": [{
                "challengeID": "Challenge_A",
                "badgeURL": "http://a.espncdn.com/i/insider/images/kiperboard/4.jpg",
                "pointsTotal": 65,
                "points7Days": 65,
                "level": 4,
                "levelTitle": "Chal_A_L_4",
                "levelDescription": "Challenge_A_Level_4 Description"},
            {
                "challengeID": "_default",
                "badgeURL": "http://cdn.gigya.com/gs/i/GMBadges/Enthusiast.png",
                "pointsTotal": 320,
                "points7Days": 320,
                "level": 2,
                "levelTitle": "Enthusiast",
                "levelDescription": "Earn points for all of the actions you take on the site..."}]},
        {
            "UID": "00003",
            "name": "Allan",
            "photoURL": "http://www.channelufx.com/lifestyle/images/small/6.gif",
            "rank": 3,
            "type": "other",
            "achievements": [{
                "challengeID": "_default",
                "badgeURL": "http://cdn.gigya.com/gs/i/GMBadges/Beginner.png",
                "pointsTotal": 175,
                "points7Days": 175,
                "level": 1,
                "levelTitle": "Beginner",
                "levelDescription": "Earn points for all of the actions you take on the site..."}]},
        {
            "UID": "00004",
            "name": "AssafEshthree Esh",
            "photoURL": "http://graph.facebook.com/715809304/picture?type=square",
            "rank": 4,
            "type": "other",
            "achievements": [{
                "challengeID": "_default",
                "badgeURL": "http://cdn.gigya.com/gs/i/GMBadges/Beginner.png",
                "pointsTotal": 70,
                "points7Days": 70,
                "level": 1,
                "levelTitle": "Beginner",
                "levelDescription": "Earn points for all of the actions you take on the site..."}]},
        "statusCode": 200,
        "errorCode": 0,
        "statusReason": "OK",
        "callId": "7ec13b6839e14cc0b2b5ab4070787903",
        "time": "2015-03-22T11:42:25.943Z"
    }