Quiz Data - Web Service Data Structures

Quiz Data - Web Service Data Structures

Once submitted, quiz information is a complex combination of different data points. Individual quizzes and questions are stored as a node types in the system. Quizzes are a simple type, however each question type is it’s own bundle under the main quiz_question content type.

Current question types.

machine_name bundle

Type

machine_name bundle

Type

long_answer

Long answer WYSIWYG

matching

Matching

multichoice

Multiple choice

quiz_directions

Quiz directions markup

quiz_page

Quiz page meta structure

quiz_question

The base question entity type

scale

Likert scale questions

short_answer

Short answer text fields

truefalse

True/False

To filter by specific question type, including the title, such as multi choice question, you make a GET call as such:

GET node.json?type=multichoice

Individual question configurations, such as allowed options and/or the correct option, are currently unavailable via web services.

Quiz nodes are one of the main content types, see Content - Web Service Data Structures

To get list of all quiz nodes, query the node endpoint filtering by type quiz

GET node.json?type=quiz

Find results for a specific quiz

The quiz_result endpoint returns a list of all results from specific quizzes, filtering by nid to get all results for a specific quiz. Individual quiz results are keyed to the Quiz Result ID (result_id).

GET quiz_result.json?nid=2430

OR if Result ID is known

GET quiz_result/148.json

{ "result_id": 148, // Unique result ID "nid": 2430, // Node ID of the quiz "uid": 67376, // User ID who took the quiz "time_start": 1416942115, // Quiz start timestamp (Unix) "time_end": 1416942644, // Quiz end timestamp (Unix) "released": 0, // Whether the result is released (0 = No, 1 = Yes) "score": 70, // Score obtained by the user "is_invalid": 0, // Whether the result is invalid (0 = valid) "is_evaluated": 1, // Whether the if this quiz requires manual grading and if it has been graded. "time_left": 0, // Not used "attempt": 1, // Attempt number of the quiz "type": "quiz_result" // Type identifier for the record }

You can apply filters to get records based on various criteria:

To get list of quiz results related to quiz node id - 2430

GET quiz_result.json?nid=2430

To get list of quiz results related to user with uid - 67376

GET quiz_result.json?uid=67376

To get list of quiz results related to user with uid - 67376 and quiz node id - 3940

GET quiz_result.json?uid=67376&nid=3940

 

 

Quiz Result Answer

Return a list of quiz result answers. These are score results from a question in a quiz.

The results do not include question data, like title or options.

Filter by result_id from the quiz_result endpoint, to get a list of scores for a specific result.

result_id is available from quiz results.

GET quiz_result_answer.json?nid=2430

{ "result_answer_id": 78, // Unique ID for the quiz result answer "result_id": 23, // Associated quiz result ID "question_nid": 181, // Node ID of the question "question_vid": 247, // Version ID of the question "tid": 0, // The taxonomy ID this question response was answered within "is_correct": 1, // Whether the answer was correct (1 = Yes, 0 = No) "is_skipped": 0, // Whether the question was skipped "points_awarded": 0, // Points awarded for this answer "answer_timestamp": 1404753238, // Timestamp of when the answer was answered "number": 1, // Question number in the quiz "display_number": null, // The display number of the question in the result. "is_doubtful": 0 // whether the user marked this answer as doubtful. }

We can apply various filters to get specific Quiz result answers

To get list of quiz result answer for quiz with question id - 181

GET quiz_result_answer.json?question_nid=181

To get list of quiz result answer for quiz with question id - 181 and answer is correct

GET quiz_result_answer.json?question_nid=181&is_correct=1

To get list of answers for specific quiz result use quiz result_id

GET quiz_result_answer/148.json