Gigya Job Openings

gm.getChallengeStatus 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 retrieves the current status of the user in each of the specified challenges.

 

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
UID string The unique ID of the user with which this method call is associated (i.e., the logged-in user whom is performing the action on the client-side and triggering the REST call). This is the UID you receive from Gigya after a successful login of this user. See User.UID for more information.
  • The UID parameter is required when you call this method through one of the following interfaces:  PHP SDKPython SDKJava SDKNET SDK  or if you are using the REST API directly with Gigya's proprietary authorization method.
  • The UID parameter is not required when you call this method through one of the following interfaces: Android SDK, iOS SDK or if you are using an external OAuth2 SDK.
Note: If you are using account linking then the UID would be your site user ID. To learn more about Social Login with account linking (best practice), please refer to the Social Login Implementation guide.
includeChallengesstring

Comma separated list of challenges to include in the response. The default value is '*', representing all the challenges that the site has to offer.
Note: Challenges that are listed in the excludedChallenges parameter are not displayed.

If you have the Hide challenge from user until first level is achieved option selected in the challenge settings for the specified challenge and the user has not yet unlocked the challenge, the request to getChallengeStatus will fail with an error:

"errorMessage": "Invalid parameter value",
"errorDetails": "Invalid included challenge IDs specified",
"statusCode": 400,
"errorCode": 400006
excludeChallengesstringComma separated list of challenges to exclude from the response. The default value is '' (empty string), meaning that no challenges that the site has to offer are to be excluded.
detailsstringCan be either 'basic' or 'full'. The default value is 'basic'.
extraFieldsstringCurrently the only value supported for this field is "pointsThisMonth". When specified, a new field is added to each challenge in the achievement object called pointsThisMonth, which contains number of points the user has earned in that challenge in the current month.
actionAttributesJSON objectThis parameter is used to retrieve the current status of the user according to a specific attribute, for example you can retrieve the user's status only on the "Glee" page of a site, instead of his status on 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. 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.

 

UIDstringThe unique ID of the user with which this data is associated.
achievementsarrayAn array listing the user's achievements. Each achievement is represented by an object that includes the following fields: 
  • challengeID - the unique ID of the chalenge.
  • level - the level that this user reached within this challenge.
  • isNewLevel - this field's value is usually 'false'. When a user advances to the next level, the GM engine sets this field to 'true'. This way your site may inform the user of reaching a new level. Using the gm.resetLevelStatus method, you may reset the isNewLevel field's value back to 'false'.
  • pointsTotal - total accumulated pointsThis value cannot be less than zero.
  • points7Days - points accumulated during the past 7 days. This value cannot be less than zero.
    Note: If you redeem points using gm.redeemPoints the points will be deducted only from the pointsCurrent field (see below). The pointsTotal and points7Days fields may only accumulate and never be deducted.
  • rank - the location of the user in comparison to all other site users determined by the total accumulated points (pointsTotal).
  • rank7Days - the location of the user in comparison to all other site users determined by points accumulated during the past 7 days (points7Days).
  • badgeURL - the URL of the image file of the current level's badge.
     
If the details parameter in the request is set to 'full', then each achievement object will also include the following fields:
  • levelTitle
  • levelDescription
  • challengeTitle
  • challengeDescription
  • pointsCurrent - these are the points accumulated by the user minus the points redeemed by the site (using gm.redeemPoints). Always pointsCurrent <= pointsTotal. This value cannot be less than zero.
  • requiredAchievement - the name of the achievement required to reach the next level. If this challenge has one action associated with it then requiredAchievement would be the name of this action. If this challenge has more than one action associated with it then requiredAchievement would be "points".
  • achievementsToNextLevel - the number of achievements required to reach the next level. If this challenge has one action associated with it then achievementsToNextLevel would be the number of actions needed to be performed to reach the next level. If this challenge has more than one action associated with it, then achievementsToNextLevel would be the number of points required to reach the next level.
  • nextLevelTitle
  • nextLevelDescription
  • nextLevelLockedBadgeURL
  • nextLevelActionURL - a URL to which a user can be redirected to perform an action and earn points. You may define this URL in the Challenges Setup=>Levels Settings. Read more in the Configuration and Administration Guide.
     
Notes:
  • When the user has not reached enough points for level 1 he is considered at level 0.
  • When the user is at level 0 all the current level information fields (levelTitle and levelDescription and badgeURL) are null.
pointsStatusintegerIndicates how many points are required in order to achieve the next level. In case the user has already earned the number of point required to pass this level, this parameter will not be included in the response. For example, in a mixed action/point based level, if a user has already earned more than the required number of points to advance, but has not completed all required actions, they will have a negative pointsStatus for that level.
To illustrate: Assume that a user is on level 4 and wishes to advance to level 5. In order to advance to level 5, the user needs to earn 150 points and post two comments. Currently, the user has earned 200 points and posted one comment. In this scenario, pointsStatus = -50 (the user has 50 points more than required to advance to the next level) and will not be returned in the response.
actionStatusarray of objectsAn array of actions that are required in order to achieve the next level. The action is an object that includes the following fields:
  • actionID - the identifier of the action
  • completed - the number of actions achieved in the current level
  • required - the total number of actions that are required in order to achieve the next level.

For example:
actionStatus: [
    {
       share, // the action
       2, // 2 shares have already been done
       4 // 4 share are needed in total
   },
   {
       comment,
       2,
       5
   }
]

 

Response Example

{
        "UID": "000000",
        "achievements": [{
            "challengeID": "Challenge_A",
            "level": 6,
            "isNewLevel": false,
            "pointsTotal": 260,
            "points7Days": 60,
            "rank": 5,
            "rank7Days": 6,
            "badgeURL": "http://a.espncdn.com/i/insider/images/kiperboard/6.jpg"},
        {
            "challengeID": "Challenge_B",
            "level": 4,
            "isNewLevel": false,
            "pointsTotal": 400,
            "points7Days": 400,
            "rank": 2,
            "rank7Days": 2,
            "badgeURL": "http://assets.espn.go.com/i/mag/blog/2011/lawNum/bold/4.jpg"},
        {
            "challengeID": "_default",
            "level": 3,
            "isNewLevel": false,
            "pointsTotal": 3195,
            "points7Days": 3195,
            "rank": 15,
            "rank7Days": 14,
            "badgeURL": "http://cdn.gigya.com/gs/i/GMBadges/Expert.png"} ],
        "statusCode": 200,
        "errorCode": 0,
        "statusReason": "OK",
        "callId": "4a5d442904e34d20bf5b1023ce1c4bbf",
        "time": "2015-03-22T11:42:25.943Z"
    }
}

When requesting details=full :

{
        "UID": "0000000",
        "achievements": [{
            "challengeID": "Challenge_A",
            "level": 6,
            "isNewLevel": false,
            "pointsTotal": 560,
            "points7Days": 160,
            "rank": 6,
            "rank7Days": 7,
            "badgeURL": "http://a.espncdn.com/i/insider/images/kiperboard/6.jpg",
            "levelTitle": "Champion",
            "levelDescription": "Your are the champion of this challenge",
            "challengeTitle": "A challenge",
            "challengeDescription": "Challenge A description",
            "pointsCurrent": 100,
            "achievementsToNextLevel": 2000,
            "requiredAchievement": "points",
            "nextLevelTitle": "Superman",
            "nextLevelDescription": "You are Superman!",
            "nextLevelLockedBadgeURL": "http://www.megamillions.com/images/balls/6.gif",
            "nextLevelActionURL": "http://yoursite.com/nextLevelAction.htm?level=Challenge_A_Level_6"},
        {
            "challengeID": "_default",
            "level": 3,
            "isNewLevel": false,
            "pointsTotal": 3210,
            "points7Days": 3210,
            "rank": 10,
            "rank7Days": 12,
            "badgeURL": "http://cdn.gigya.com/gs/i/GMBadges/Expert.png",
            "levelTitle": "Expert",
            "levelDescription": "Earn points for all of the actions you take on the site...",
            "challengeTitle": "Gigya default challenge",
            "challengeDescription": "Default challenge",
            "pointsCurrent": 3210,
            "achievementsToNextLevel": 6790,
            "requiredAchievement": "points",
            "nextLevelTitle": "Master",
            "nextLevelDescription": "Earn points for all of the actions you take on the site...",
            "nextLevelLockedBadgeURL": "http://cdn.gigya.com/gs/i/GMBadges/Master_Locked.png"}],
        "statusCode": 200,
        "errorCode": 0,
        "statusReason": "OK",
        "callId": "467cfc503b974a9d8483882b7cda0792"
    }