User Code Submit


Request Details

Item Value
Description Submits a code from a code redemption campaign.
Method POST
Endpoint https://api.crowdtwist.com/v2/code_redemption_campaign/submit?api_key=[api_key]&id_type=[id_type]
Content Type JSON (application/json)
Note Question id’s will change each time a modification is made to the code redemption campaign. Because of this, it is is best to make a Code Redemption Campaign call first to determine the ID’s.


Request

Field Name Sample Value Required Format Notes
URL PARAMETERSnone
QUERY STRING PARAMETERS
api_key QWERTYUIOP Yes String  
id_type email No String Type of ID being sent, defaults to ID if not specified.
Options:
  – email
  – facebook_user_id
  – twitter_user_id
  – id (CrowdTwist ID default if blank)
  – third_party_id
  – username
  – mobile_phone_number
REQUEST BODY
user_id 1 Yes Mixed Unique ID of the user for whom activities will be returned
campaign_id 23 Yes String ID of code redemption campaign code is submitting to.
code_value AD8DAB Yes String Code user is submitting.
questions_answers Question Answer Object No Array Option array of answers to option questions.
REQUEST BODY – Question Answer Object
id 45 No String ID of question.
value Drug Store No String Answer to question.


Successful Response

Field Name Sample Value Required Format Description
num_points 100 No Integer On success – the number of points earned for redeeming code.


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.
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.
invalid_code This code does not exist.
limit_reached Max redemption limit reached.
questions_required Answers to one or more questions required.


Sample Request

curl -X POST
https://api.crowdtwist.com/v2/code_redemption_campaign/submit?api_key=QWERTYUIOP
{
  "user_id": "1",
  "campaign_id": "23",
  "code_value": "AD8DAB",
  "question": [
    {
      "id": "45",
      "value": "Drug Store"
    }
  ]
}
  
curl -X POST
https://api.crowdtwist.com/v2/code_redemption_campaign/submit?api_key=QWERTYUIOP
{
  "user_id": "1",
  "campaign_id": "23",
  "code_value": "AD8DAB",
  "question": [
    {
      "id": "45",
      "value": "Drug Store"
    }
  ]
}
  


Sample Successful Response: Status Code 200

{
  "num_points" : 100
}
{
	"num_points" : 100
}

Sample Error Response: Status Code 400

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

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

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