User Quiz Results

Request Details

Item Value
Description This endpoint returns quiz response for specific user.
Method GET
Endpoint https://[environment]api[client_id].crowdtwist.com/v2/users/[user_id]/quiz/[activity_id]/response?api_key=[api_key]&id_type=[id_type]
Content Type application/json

Request

Field Name Sample Value Required Format Notes
URL PARAMETERS
user_id 123, "example@example.com" Yes integer, string The ID of the user.
activity_id 1 Yes Integer The ID of the quiz.
QUERY STRING PARAMETERS
api_key QWERTYP 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

Response

Response Body

Field Name

Sample Value

Required

Format

Description

quiz_response See the QUIZ RESPONSE ARRAY section. Yes Array An array of quiz response objects.
QUIZ RESPONSE ARRAY
question_id 10 Yes Integer The id of the question.
selected_answers [1,2,3] No Array An array containing one or more selected answer.



Error Responses

Field Name

Sample Value

Required

Format

Description

error

Field value is empty.

Yes

String

This is a short form of the error.

message

Value of field [fieldname] must not be empty

Yes

String

This is a detailed message around the error specifying, as specifically as possible, what the fields are that are missing or where exactly the error is.


Error Response Codes

Error Error Code Description Reason
Input Error 4xx Returned whenever the request is missing required fields, including situations in which the body is malformed (e.g. HTTP method not supported, receipt not found, etc.). – missing_data
– not_unique
– receipt_not_found
– invalid_amount
– invalid_currency
– invalid_date
– invalid_custom_field
– invalid
Server Error 5xx HTTP error status code is returned due to an error that occurred in the backend. – internal_error: unexpected error occurred in the CrowdTwist backend
– missing_field
– invalid_data
– not_configured: error occurs when an configuration has not been configured yet


Example Response Codes

Response Code Error Message
400 param_error Request made on a [quiz] questionnaire, but activity [activity_id] is a [questionnaire_type].
404 page_not_found Could not locate a response for user [user_id] on the quiz associated to activity id [activity_id].
404 page_not_found Unable to find quiz.

Samples

Sample Request

curl -X GET 'https://sb-api12.crowdtwist.com/v2/users/test@crowdtwist.com/quiz/123/response?api_key=QWERTYUIOP&id_type=email'

 

Sample Response Body

{ "quiz_response": [ { "question_id": 1, "selected_answers": [ 1, 3 ] }, { "question_id": 2, "selected_answers": [ 3 ] } ] }

 

Sample Error Response

{ "error": "page_not_found", "message": "Unable to find quiz." }