Docs home

Create Online Exercise

Creates an exercise or assignment inside a course section. Online exercises get one empty part ("Part A"); attach a question bank to it next. Paper-based exercises (`exam_type` `2`) become assignments where learners upload their work.

POST/exercises
Create Online Exercise
curl --request POST \
  --url 'https://<your-api-host>/nuSource/api/v1/exercises' \
  --header 'APIKEY: <your-api-key>' \
  --header 'ORGID: <your-org-id>' \
  --form 'JSONString={"section_id":"6174","is_timed":true,"exercise_name":"Online Exercise","instructions":"<p>General Instructions Write Here</p>","test_time":1800,"exam_type":1,"sound_play_times":-1,"results_declared":0,"attempts":2,"show_compiler":0,"show_calculator":0,"is_psycological":0,"is_prerequisite":1,"passing_mark":"33","is_assignment":0,"is_parts_timed":1,"is_parts_locked":1,"is_partial_marking_enabled":0,"skip_declaration":0}'
{
  "code": 200,
  "message": "Exercise Created",
  "exercise": {
    "exercise_id": 1026,
    "exercise_name": "Online Exercise",
    "section_id": "6174",
    "question_list_id": null,
    "attempts": 2,
    "resource_type": 5,
    "file_details": []
  }
}

Access: Institute admins, admins, tutors who contribute to the section's course, plus custom roles with curriculum or question bank write permission.

Request body: form-data with one field, JSONString, containing this JSON:

BodyJSONString
section_idintegerrequired
Curriculum section to add the exercise to.
Name, no < or >.
Instructions, HTML allowed.
exam_typeinteger
1 online exercise with questions (default), 2 paper-based assignment (file upload).
2 creates a programming assignment (must be enabled for your institute). Otherwise set from exam_type.
is_timedinteger
1 if there is a time limit. Required for proctoring.
test_timeinteger
Time limit in seconds. Default 0. Required when is_parts_timed is 1.
attemptsinteger
Attempts allowed. Default -1 (unlimited).
1 results are declared to learners, 0 held back. Default 0.
Pass mark. Default 50.
max_marksinteger
Maximum marks (assignments). Default 0.
1 advanced, 2 basic.
1 learners must finish it before later content.
1 gives each part its own time / forces parts in order.
1 shows a calculator / code compiler.
1 partial marks on multiple-correct questions.
1 skips the declaration screen.
1 practice mode. Cannot be combined with proctoring.
0 off, 1 proctored, 2 proctored with screen and video recording. Needs is_timed.
Reference sheet shown during the exercise.
Minimum class attendance needed to attempt.
1 the assignment has due dates.
1 accepts work after the due date.
Due dates per batch, used when use_due_date is 1: {"classes": [{"class_id": 1, "type": 2, "end_date": 1735689600}]}. type 1 always open, 2 custom end date.
Late-submission penalty rules. Exact value meanings unclear from this handler.
1 turns on AI grading for paper-based assignments.
Instructions for the AI grader.
bundle_idinteger
Purpose unclear from this handler.
file_1file
A file attached to the exercise (PDF, Office, ZIP/RAR, audio, video, Python, notebook, JSON), up to 500 MB.
Model answer sheet for AI grading (paper-based assignments).
Response200application/json
codeinteger
Example: 200
messagestring
Example: Exercise Created
exerciseobject
Show child attributesHide child attributes
Example: 1026
Example: Online Exercise
Example: 6174
Example: 2
5 = exercise
Example: 5

Notes: Errors: "Invalid section id"; "For proctoring time is required."; "Proctoring is not supported in practice mode."; "Please add the total test time if sectional timing enabled"; an error when programming assignments are not enabled for your institute. Rate limit: 30 requests per minute; going over locks you out for 30 minutes.

Updated yesterday

Ask AI