Get Super Fan Ranking

From KickApps Documentation

Jump to: navigation, search

Contents

Overview

This method returns a user’s badge earning ranking by specified location. “Locations" is returned containing the location and rank of the specified user within that location. Rank is determined by a “descending sort of badge quantity” + “timestamp of user’s last earned badge for the location” by location for the specified user; users with the same number of badges (a tie) are given a higher ranking by time the last badge was awarded. Use Case: The user’s profile displays a user’s superfan rank for each site location. The users returned in the result set must have earned enough badges to meet or exceeded the number of badges required for the specified location.


Request URL

http://api.kickapps.com/rest/mostbadged/userrank/get/{as}


Request Parameters

Required

  • t - the user token generated via the "Create Token" API call.
  • as - The site Id to search. as is unique for each of the affiliate's sites.
  • locations – A comma separated list of location identifiers that corresponds to a page / area within the community. Standard comma separated conventions will be followed; e.g. “51, area”, area, “area 42”.


Optional

  • user_id – the user ID of the user we’re retrieving super fan ranking of. (When this is not provided, the user_id will be derived from the token.)
  • callback. String. Optional. The name of your JavaScript callback function.

Response

Note: if callback is provided as an optional argument, the results illustrated below will be returned within the callback string provided for execution of a JavaScript function; e.g. callback=”MyCallbackFunc” will return something similar to:

MyCallbackFunc({…the success or failure response contained in curly braces you see below…});

Note: Any location where the user has not fulfilled defined criteria will return a rank of 0. Note: A disabled user will return a rank of 0.

Success:
{
   "status":1,
   "userId":"XXXX",
   "locations":[
      {
         "location":"51,area",
         "rank":"4"
      },
      {
         "location":"area",
         "rank":"1"
      },
      {
         "location":"area 42",
         "rank":"0"
      },
      {
         "location":"area with undefined superfan criteria",
         "rank":"NAN"
      },
      
   ]
}


Failure:  {"status": -1, "errorId": "123", "error": "Error Message"}


Response Fields

  • status – 1 on success and -1 on error.
  • userId – the ID of the user whose badges are being retrieved.
  • error – A message indicating the error condition
  • errorId – A numeric reference to the error condition
  • locations – list of location and rank sets for the user_id
    • location – A location identifier that corresponds to a page / area within the community.
    • rank – The badge earning rank of this user for this location
    • time – human readable time the rank was established (“3 Nov 2010 08:21:48 GMT”)

Error codes:

  • 1 = invalid token
  • 44 = token required
  • 46 = locations cannot be null or blank

List of KickApps API Calls


Note: Occasionally (and without advanced warning) we modify our API calls by adding new parameters in the response payload. Please keep this in mind when designing your strategy for parsing our responses.