Docs home

Push Attempted Exercise Payload

Submits a student's answers to an exercise (test) and returns the marked result. Put the exercise ID in the URL. Send the answers collected after "Get Exercise Details". The same endpoint takes assignment uploads; see "Assignment Attempt".

POST/exercises/{ResourceId}/attempt
Push Attempted Exercise Payload
curl --request POST \
  --url 'https://<your-api-host>/nuSource/api/v1/exercises/{ResourceId}/attempt' \
  --form 'JSONString={"test_id":7847,"section_id":5688,"exercise_id":4199,"exercise_name":"EXE","test_parts":"[{\"test_part_id\":10422,\"questions\":\"[{\\\"question_id\\\":1461488,\\\"user_answers\\\":[{\\\"answer\\\":[\\\"Demo\\\"],\\\"user_question_time\\\":321}],\\\"user_question_time\\\":321},{\\\"question_id\\\":1443328,\\\"user_answers\\\":[{\\\"answer\\\":[\\\"0\\\"],\\\"user_question_time\\\":2}],\\\"user_question_time\\\":2},{\\\"question_id\\\":1443329,\\\"user_answers\\\":[{\\\"answer\\\":[\\\"1\\\"],\\\"user_question_time\\\":5}],\\\"user_question_time\\\":5},{\\\"question_id\\\":1482454,\\\"user_answers\\\":[{\\\"answer\\\":[],\\\"user_question_time\\\":9}],\\\"user_question_time\\\":9,\\\"difficulty\\\":1,\\\"engage_topic_tag_id\\\":1816},{\\\"question_id\\\":1657324,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":1,\\\"engage_topic_tag_id\\\":1816},{\\\"question_id\\\":586758,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"engage_topic_tag_id\\\":1816},{\\\"question_id\\\":1461493,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0},{\\\"question_id\\\":1047058,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0},{\\\"question_id\\\":179153,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"engage_topic_tag_id\\\":1816},{\\\"question_id\\\":1461487,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0},{\\\"question_id\\\":669037,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0},{\\\"question_id\\\":586759,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0},{\\\"question_id\\\":1461491,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0},{\\\"question_id\\\":1047064,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0},{\\\"question_id\\\":1657323,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":1,\\\"engage_topic_tag_id\\\":1816},{\\\"question_id\\\":1461486,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0},{\\\"question_id\\\":1461490,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0},{\\\"question_id\\\":1461489,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0},{\\\"question_id\\\":1656750,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"engage_topic_tag_id\\\":1816}]\",\"part_user_time\":337,\"max_questions_allowed\":0}]","class_id":39946,"user_test_time":337}'
{
  "code": 200,
  "message": "The Exercise has been evaluated !",
  "result": {
    "test_id": 7847,
    "section_id": 5688,
    "exercise_id": 4199,
    "exercise_name": "EXE",
    "test_parts": "[{\"test_part_id\":10422,\"questions\":\"[{\\\"question_id\\\":1461488,\\\"user_answers\\\":[{\\\"answer\\\":[\\\"Demo\\\"],\\\"user_question_time\\\":321}],\\\"user_question_time\\\":321,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":1,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1443328,\\\"user_answers\\\":[{\\\"answer\\\":[\\\"0\\\"],\\\"user_question_time\\\":2}],\\\"user_question_time\\\":2,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":-1,\\\"is_attempted\\\":1,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1443329,\\\"user_answers\\\":[{\\\"answer\\\":[\\\"1\\\"],\\\"user_question_time\\\":5}],\\\"user_question_time\\\":5,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":1,\\\"marks\\\":1,\\\"is_attempted\\\":1,\\\"exp\\\":100,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1482454,\\\"user_answers\\\":[{\\\"answer\\\":[],\\\"user_question_time\\\":9}],\\\"user_question_time\\\":9,\\\"difficulty\\\":1,\\\"engage_topic_tag_id\\\":1816,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1657324,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":1,\\\"engage_topic_tag_id\\\":1816,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":586758,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"engage_topic_tag_id\\\":1816,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":0}]},{\\\"question_id\\\":1461493,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1047058,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":179153,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"engage_topic_tag_id\\\":1816,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1461487,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":669037,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":586759,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":0}]},{\\\"question_id\\\":1461491,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1047064,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1657323,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":1,\\\"engage_topic_tag_id\\\":1816,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1461486,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1461490,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":0}]},{\\\"question_id\\\":1461489,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]},{\\\"question_id\\\":1656750,\\\"user_answers\\\":[{\\\"answer\\\":[]}],\\\"user_question_time\\\":0,\\\"difficulty\\\":2,\\\"engage_topic_tag_id\\\":1816,\\\"markedInputs\\\":[{\\\"correct\\\":0,\\\"marks\\\":0,\\\"is_attempted\\\":0,\\\"exp\\\":0,\\\"isFinalized\\\":1}]}]\",\"part_user_time\":337,\"max_questions_allowed\":0,\"part_userMark\":0,\"part_userExp\":100,\"part_totalMark\":24,\"part_total_inputs\":19,\"part_correct_inputs\":1,\"part_attempted\":3,\"part_wrong_inputs\":2,\"part_skipped\":16}]",
    "class_id": 39946,
    "user_test_time": 337,
    "test_userMark": 0,
    "test_userExp": 100,
    "test_totalMark": 24,
    "grade": 0,
    "perfect": 0,
    "passed": 0,
    "test_parts_array": [
      {
        "test_part_id": 10422,
        "questions": "[{\"question_id\":1461488,\"user_answers\":[{\"answer\":[\"Demo\"],\"user_question_time\":321}],\"user_question_time\":321,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":1,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":1443328,\"user_answers\":[{\"answer\":[\"0\"],\"user_question_time\":2}],\"user_question_time\":2,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":-1,\"is_attempted\":1,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":1443329,\"user_answers\":[{\"answer\":[\"1\"],\"user_question_time\":5}],\"user_question_time\":5,\"difficulty\":2,\"markedInputs\":[{\"correct\":1,\"marks\":1,\"is_attempted\":1,\"exp\":100,\"isFinalized\":1}]},{\"question_id\":1482454,\"user_answers\":[{\"answer\":[],\"user_question_time\":9}],\"user_question_time\":9,\"difficulty\":1,\"engage_topic_tag_id\":1816,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":1657324,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":1,\"engage_topic_tag_id\":1816,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":586758,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"engage_topic_tag_id\":1816,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":0}]},{\"question_id\":1461493,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":1047058,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":179153,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"engage_topic_tag_id\":1816,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":1461487,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":669037,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":586759,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":0}]},{\"question_id\":1461491,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":1047064,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":1657323,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":1,\"engage_topic_tag_id\":1816,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":1461486,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":1461490,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":0}]},{\"question_id\":1461489,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]},{\"question_id\":1656750,\"user_answers\":[{\"answer\":[]}],\"user_question_time\":0,\"difficulty\":2,\"engage_topic_tag_id\":1816,\"markedInputs\":[{\"correct\":0,\"marks\":0,\"is_attempted\":0,\"exp\":0,\"isFinalized\":1}]}]",
        "part_user_time": 337,
        "max_questions_allowed": 0,
        "part_userMark": 0,
        "part_userExp": 100,
        "part_totalMark": 24,
        "part_total_inputs": 19,
        "part_correct_inputs": 1,
        "part_attempted": 3,
        "part_wrong_inputs": 2,
        "part_skipped": 16
      }
    ],
    "points": 0,
    "total_inputs": 19,
    "total_correct_inputs": 1,
    "test_time": 0,
    "total_attempted": 3,
    "total_wrong_inputs": 2,
    "total_skipped": 16,
    "accuracy": 33.33,
    "isFinalized": 0,
    "user_submission": "",
    "correct_answer_time": 5,
    "incorrect_answer_time": 323,
    "low_difficulty_question": 0,
    "medium_difficulty_question": 1,
    "high_difficulty_questison": 0,
    "total_low_difficulty_question": 3,
    "total_medium_difficulty_question": 16,
    "total_high_difficulty_questison": 0,
    "attempted_low_difficulty_question": 0,
    "attempted_medium_difficulty_question": 3,
    "attempted_high_difficulty_questison": 0,
    "low_difficulty_percentage": 0,
    "medium_difficulty_percentage": 18.75,
    "high_difficulty_percentage": 0,
    "low_difficulty_accuracy": 0,
    "medium_difficulty_accuracy": 33.33,
    "high_difficulty_accuracy": 0,
    "user_topic_marks": {
      "1816": 0
    },
    "total_topic_marks": {
      "1816": 24
    },
    "user_topic_time_taken": {
      "1816": 337
    },
    "total_topics": [
      1816
    ],
    "user_topic_subjects": {
      "1816": 684
    },
    "user_topic_score": {
      "1816": 0
    },
    "user_topic_subject_score": {
      "1816": 0
    },
    "user_topic_subject_mark": {
      "1816": 0
    },
    "user_topic_subject_total_mark": {
      "1816": 24
    },
    "total_topic_question": {
      "1816": 19
    },
    "total_attempted_topic_question": {
      "1816": 3
    },
    "total_attempted_subject_question": {
      "1816": 3
    },
    "total_subject_question": {
      "1816": 19
    },
    "total_correct_attempted_topic_question": {
      "1816": 1
    },
    "total_correct_attempted_subject_question": {
      "1816": 1
    },
    "grade_range": "B++",
    "isExercise": 1,
    "attempt_id": 6527855,
    "results_declared": 1,
    "is_psycological": 0
  }
}

Access: Students (and admins). For students the exercise must be available to them in the class.

Request body: form-data with a JSONString field holding the JSON below. For assignments, also send the submission as a file field.

Path parameters
exercise_idintegerrequired
The exercise, or the quiz when is_quiz is true.
BodyJSONString
class_idintegerrequired
The class (subject batch) the student is attempting it in.
exercise_idintegerYes for assignments
Same as the path ID. Assignments are saved against this body value.
test_partsarray or JSON stringYes for tests
The student's answers (structure below). Not needed for assignments.
Seconds the student spent.
test_idinteger
The test ID from "Get Exercise Details".
attempt_idinteger
An attempt started earlier but not submitted, to submit or update it.
1 final submission (default). 0 saves answers without submitting.
is_quizboolean
true when the path ID is a quiz.
Assignments only: the student's note with the submission.
file_1file
Assignments only: the submitted file, up to 500 MB. PDF, text, Word, Excel, ZIP, RAR, 7z, images, audio, video, Python or notebook files.
Only for institutes using the Woolf integration.

Structure of test_parts: an array of parts, each {"test_part_id": ..., "questions": [...]}. Each question is {"question_id": ..., "user_answers": [{"answer": [...], "user_question_time": seconds}], "user_question_time": seconds}. answer holds the chosen option indexes (as strings) or the typed answer.

Response200application/json
codeinteger
Example: 200
messagestring
Example: The Exercise has been evaluated !
resultobject
Show child attributesHide child attributes
Example: 7847
Example: 5688
Example: 4199
Example: EXE
Example: 39946
Example: 337
Example: 0
Example: 100
Example: 24
Example: 0
Example: 0
Example: 0
Example: 0
Example: 19
Example: 0
Example: 3
Example: 2
Example: 16
Example: 33.33
Example: 0
Example: 323
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Example: B++
Example: 1
Example: 6527855
Example: 1
Example: 0

Notes:

  • Errors: "Max test attempts over" or "Maximum allowed submissions limit reached!" when attempts are used up; "Submission closed. Assignment due date has passed." when the due date has passed and late submission isn't allowed; "Param [test_parts] required" for a test submission without answers; "Attempt not submitted yet" (with the open attempt_id) for proctored exams with an unsubmitted attempt.
  • Submissions send an "exercise submitted" webhook if your institute has one. Assignments with AI evaluation turned on are queued for AI grading.
  • Rate limit: 30 requests per minute; going over locks you out for 30 minutes.

Updated yesterday

Ask AI