User Activity History


Request Details

Item Value
Description Returns the list of activities a user has completed.
Method GET
Endpoint https://api.crowdtwist.com/v2/users/[user_id]/activity_history?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
page_size 10 No Integer If using pagination in request, the number of items per page.
Note: if used, must be used with page_number
page_number 1 No Integer If using pagination in request, the page number to be returned.
Note: if used, must be used with page_size


Successful Response

Field Name Sample Value Required Format Description
activity_id 225 Yes String CrowdTwist internal ID for activity.
date_created 1425404945 Yes String Date activity was recorded.
name 225 Shared a link String Name of activity.
num_points 1000 Yes Interger Points earned for completing activity.
extra_data {
“url”: “http://www.someurl.com/shared.html”,
“message”: “Check this out!”,
“email”: “person@email.com”
}
No JSON Extra data set via User Activity Credit API.


Error Response

Field Name Sample Value Required Format Description
error param_error Yes String A machine readable code that describes the error.
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.
param_error A missing or invalid parameter is included in the request.
page_not_found The requested page does not exist or has been removed.


Sample Request

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


Sample Successful Response: Status Code 200

[  
   {  
      "activity_id":"225",
      "date_created":1425404945,
      "name":"visited site",
      "num_points":10
   },
   {  
      "activity_id":"223",
      "date_created":1425404945,
      "name":"made purchase",
      "num_points":10
   },
   {  
      "activity_id":"215",
      "date_created":1425404945,
      "name":"shared link",
      "num_points":100,
      "extra_data":{  
         "url":"http://www.someurl.com/shared.html",
         "message":"Check this out!",
         "email":"person@email.com"
      }
   }
]
[  
   {  
      "activity_id":"225",
      "date_created":1425404945,
      "name":"visited site",
      "num_points":10
   },
   {  
      "activity_id":"223",
      "date_created":1425404945,
      "name":"made purchase",
      "num_points":10
   },
   {  
      "activity_id":"215",
      "date_created":1425404945,
      "name":"shared link",
      "num_points":100,
      "extra_data":{  
         "url":"http://www.someurl.com/shared.html",
         "message":"Check this out!",
         "email":"person@email.com"
      }
   }
]

Sample Error Response: Status Code 400

{
  "error": "param_error",
  "message": "Missing the username parameter."
}
{
  "error": "param_error",
  "message": "Missing the username parameter."
}