Docs home

Assignment Attempt

Submits a student's assignment: an uploaded file and/or a comment. Put the assignment's exercise ID in the URL. The submission waits for a tutor to grade it with "Evaluate Assignment and Update Marks". The same endpoint takes test answers; see "Push Attempted Exercise Payload".

POST/exercises/{exercise_id}/attempt
Assignment Attempt
curl --request POST \
  --url 'https://<your-api-host>/nuSource/api/v1/exercises/{exercise_id}/attempt' \
  --header 'APIKEY: <your-api-key>' \
  --header 'ORGID: <your-org-id>' \
  --form 'file_1=' \
  --form 'JSONString={"test_id":0,"section_id":169940,"exercise_id":73182,"exercise_name":"asfdcasdf","class_id":"135638","user_test_time":0,"student_comments":"Submission Addtional Comments"}'
{
  "code": 200,
  "message": "success",
  "attempt_id": 15056317,
  "is_exam_certificate_applicable": false
}

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: success
attempt_idinteger
Example: 15056317
true if passing earns a certificate
Example: false

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