Docs home

Get Batch Class Section Details (Programming Assignments)

Returns the questions of an assignment, plus the assignment's settings. For programming assignments each question has a description, sample input and output, and the allowed languages. Use it to show an assignment to a learner.

GET/assignments/questions
Get Batch Class Section Details (Programming Assignments)
curl --request GET \
  --url 'https://<your-api-host>/nuSource/api/v1/assignments/questions?assignment_id=<Assignment Id>&class_id=<ClassId>'
{
  "code": 200,
  "message": "Success",
  "questions": [
    {
      "question_id": 6,
      "assignment_id": 8,
      "question": {
        "description": "<p>Subtract 2 from input, if number less than 2 return 0</p>",
        "sample_input": [
          "4"
        ],
        "sample_output": [
          "2"
        ],
        "allowed_languages": [
          62,
          70
        ]
      },
      "file_id": null,
      "marks": null,
      "id": null,
      "file_name": null,
      "file_type": null,
      "file_path": null,
      "file_size": null,
      "file_extension": null,
      "user_id": null,
      "organization_id": null,
      "entity_type": null,
      "created_at": null,
      "assignment_type": 2
    }
  ],
  "entity": {
    "assignment_id": 8,
    "name": "Assignment 1",
    "description": "",
    "course_id": 23,
    "activate_at": 0,
    "deactivate_at": null,
    "availability": 1,
    "allow_late_submissions": 0,
    "max_submissions_allowed": 1,
    "is_common": 1,
    "marks": 100,
    "status": "published",
    "display_index": 4956,
    "resource_type": 3,
    "assignment_type": 2,
    "instructions": "",
    "test_time": 0
  }
}

Access: Any signed-in user who has access to the assignment's course (learners enrolled in it, its tutors, admins).

Query parameters
assignment_idintegerrequired
Assignment ID, from the batch curriculum.
class_idintegerrequired
Batch (class) ID. Used for drip-schedule checks and to record the learner's last viewed item.
Response200application/json
codeinteger
Example: 200
messagestring
Example: Success
questionsobject[]
Each
Show child attributesHide child attributes
Example: 6
Example: 8
Show child attributesHide child attributes
Example: <p>Subtract 2 from input, if number less than 2 return 0</p>
1 normal, 2 programming
Example: 2
entityobject
The assignment
Show child attributesHide child attributes
Example: 8
Example: Assignment 1
Example: 23
Example: 0
Unix timestamps
Example: 1
Example: 1
Example: 100
published or draft
Example: published
Example: 4956
3
Example: 3
1 normal, 2 programming
Example: 2
Example: 0

Notes: Learners get "assignment.not.published" for drafts. Other errors: "invalid.assignment.id" (not found or no access), and drip-schedule errors when the assignment is not yet available. Rate limit: 30 requests per 1 minute; going over locks you out for 30 minutes.

Updated yesterday

Ask AI