EiTV CLOUD supports adding different types of quizzes on the platform, using a quiz ID, you can get all information about this content.
method: GET
URL: /quizzes/[ID].json
RETURN: { "page": "quiz", "quiz": { "id": "ID", "name": "NAME", "description": "DESCRIPTION", "html_description": "HTML ADDITIONAL DESCRIPTION", "quiz_type": "QUIZ TYPE", "graded", "progress", "poll" "correction_mode": ["automatic"|"manual"], "max_attempts": NUMBER, "min_score": NUMBER, # in percent "duration": true/false, "start": "START DATE", "end": "END DATE", "valid_interval": true/false, # case duration is true "promote": true/false, # home "message": "MESSAGE", # case quiz_type is "poll" "show_result": true/false, "date": "DATE", "type": "quiz", "time_ago_in_words": "FULL DATE", "last_view_time: NUMBER, "questions": [ { "id": "ID", "name": "NAME", "question_text": "TEXT", "question_type": "["check_box"|"radio_button"|"text_box"|"file_upload"] "question_score": NUMBER, # float "answers_type": ["text"|"html"], "answers_comment": true/false, "answers_comment_type": ["correct_answers"|"all_answers"], "answers_values": [ { "text": "TEXT|HTML", "comment": "TEXT|HTML", # case answers_comment is true "correct": true/false # case max attempts limit reached and quiz_type is not "poll" "percent": NUMBER # case max attempts limit reached and quiz_type is "poll" } ], "type": "question", "properties": [ # If exist custom fields { "id": null, "custom_field_id": ID, "value": null } ] } ], "properties": [ # If exist custom fields { "id": null, "custom_field_id": ID, "value": null } ] } "answers": [ { "id": "ID", "question_id": "QUESTION ID", "value": "POSITION" "upload": { # if question_type == "file_upload" "id": "ID", "type": "upload" } "score": NUMBER, "comment": "TEXT", "type": "answer" } "quiz_result": { "id": "ID", "num_attempts": NUMBER, "max_attempts": true/false, # max attempts limit reached "score": NUMBER, "score_percent": NUMBER, "status": "STATUS", "passed", "pending", "failed" "type": "quiz_result" } }
Following, we show how to get a specific content thumbnail:
URL: /quizzes/[ID]/retrieve?format=thumb
ID: format NUMBER-TEXT
To answer the quiz, use the following method:
method: POST
URL: /quizzes/[ID].json # quiz ID consists of NUMBER-TEXT
PARAMETERS: { "quiz_result": { "quiz_attributes": { "questions_attributes": { "INDEX": { "answers_attributes": { "INDEX": { "value": "POSITION", "check_box" = “” or “|1|” or "|1||2|" or ..., "radio_button" = "1" or "2" or ... "upload_attributes": { # if question_type == "file_upload" "upload_file": "FILE" } "question_id": "QUESTION ID", "user_id": "USER ID", "id": "ID" } }, "id": "QUESTION ID" } }, "id": "QUIZ ID" } } } } RETURN: { "status": true/false, # status_code 200/400 "errors": { # caso "status" = false "quiz_result": { "FIELD": [ # "quiz.questions.answers.value" "ERROR MESSAGE" ], "quiz.questions.answers": [ { "question_id": "QUESTION ID", "errors": { "value": [ "ERROR MESSAGE" ] } } ] } } }
To get the player for the uploaded file:
method: GET
URL: /quizzes/[QUIZ_ID]/quiz_results/[QUIZ_RESULT_ID]/uploads/[ID]/play
<< Previous topic | Next topic >> |
---|