User Rank


Request Details

Item Value
Description Returns users rank.
Method GET
Endpoint https://api.crowdtwist.com/v2/users/[user_id]/rank?api_key=[api_key]&id_type=[id_type]


Request

Field Name Sample Value Required Format Notes
URL PARAMETERS
user_id alice@crowdtwist.com Yes String Unique ID of the user for whom activities will be returned:
Options:
– Email Address
– Facebook User ID
– Twitter User ID
– CrowdTwist ID
– Third Party ID
– Username
– Mobile Phone Number
QUERY STRING PARAMETERS
api_key QWERTYUIOP Yes String  
id_type email No String Type of ID being Sent:
Options:
– email
– facebook_user_id
– twitter_user_id
– id (CrowdTwist ID) – default ID if id_type is not specified
– third_party_id
– username
– mobile_phone_number


Successful Response

Field Name Sample Value Required Format Description
total_registrations 44265 Yes Integer Total registrations in the program
rank 74407 Yes Integer Overall rank in the program compared to other members
weekly_rank null No Integer Weekly rank in the program compared to other members
monthly_rank 15 No Integer Monthly rank in the program compared to other members
ahead [
{
"id": 45955352,
"username": "user1234",
"total_points": 1450,
"facebook_user_id": "120806358310381",
"rank": 74405,
"weekly_rank": null,
"monthly_rank": 21
}
]
Yes Array Details of the member ranked above the requested user
behind [
{
"id": 47697874,
"username": "abs2232",
"total_points": 0,
"facebook_user_id": null,
"rank": 74578,
"weekly_rank": null,
"monthly_rank": null
}
]
Yes Array Details of the member ranked behind the requested user
AHEAD & BEHIND OBJECT
id 47697874 Yes Interger CrowdTwist ID for the user ahead/behind.
username abs2232 Yes String Username for the user ahead/behind.
total_points 6585 Yes Interger Total points for the user ahead/behind
facebook_user_id null No Interger Facebook User ID for the user ahead/behind.
rank 74405 No Interger Rank of the user ahead/behind.
weekly_rank null No Interger Weekly rank of user ahead/behind.
monthly_rank null No Interger Monthly rank of user ahead/behind.


Error Response

Field Name Sample Value Required Format Description
error param_error Yes String Missing the user_id parameter.
message Missing the user_id parameter. Yes String A short, descriptive sentence detailing the error.


Error Response Codes

Error Message
input_error The input provided in invalid or formatted incorrectly.
internal_error Something went wrong on our end.
page_not_found The requested page does not exist or has been removed.
param_error A missing or invalid parameter is included in the request.


Sample Request

curl -X GET
https://api.crowdtwist.com/v2/users/alice@crowdtwist.com/rank?api_key=QWERTYUIOP&id_type=email
curl -X GET
https://api.crowdtwist.com/v2/users/alice@crowdtwist.com/rank?api_key=QWERTYUIOP&id_type=email


Sample Successful Response: Status Code 200

{
  "total_registrations": "44265",
  "rank": 74407,
  "weekly_rank": null,
  "monthly_rank": 15,
  "ahead": [
    {
      "id": 45955352,
      "username": "userabc",
      "total_points": 1450,
      "facebook_user_id": "120806358310381",
      "rank": 74405,
      "weekly_rank": null,
      "monthly_rank": 21
    }
  ],
  "behind": [
    {
      "id": 47697874,
      "username": "abs2232",
      "total_points": 0,
      "facebook_user_id": null,
      "rank": 74578,
      "weekly_rank": null,
      "monthly_rank": null
    }
  ]
}
{
  "total_registrations": "44265",
  "rank": 74407,
  "weekly_rank": null,
  "monthly_rank": 15,
  "ahead": [
    {
      "id": 45955352,
      "username": "userabc",
      "total_points": 1450,
      "facebook_user_id": "120806358310381",
      "rank": 74405,
      "weekly_rank": null,
      "monthly_rank": 21
    }
  ],
  "behind": [
    {
      "id": 47697874,
      "username": "abs2232",
      "total_points": 0,
      "facebook_user_id": null,
      "rank": 74578,
      "weekly_rank": null,
      "monthly_rank": null
    }
  ]
}

Sample Error Response: Status Code 400

{
  "error": "param_error",
  "message": "User does not exist."
}
{
  "error": "param_error",
  "message": "User does not exist."
}