Assignments

Assignments are what will define the grade of a student. Assignments are referenced by assignment_grades to get their general info such as max_grade and attachments.

The assignment model

The assignment model contains all the information about the assignments.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the assignment.

  • Name
    course_id
    Type
    string
    Description

    Unique identifier for the course the assignment belongs to.

  • Name
    title
    Type
    string
    Description

    Title of the assignment.

  • Name
    description
    Type
    string
    Description

    Describe what the assignment is about or what needs to be done.

  • Name
    due_date
    Type
    string
    Description

    Date and time the assignment is due by.

  • Name
    category
    Type
    string
    Description

    Shows if the assignment is major, minor, or practice. The category of the assignment shows how much or how little it can affect the overall grade of a course

  • Name
    max_grade
    Type
    number
    Description

    Max score an assignment can have. Will affect the max_grade of the course it belongs to when being made or changed.

  • Name
    type
    Type
    string
    Description

    Shows if the assignment is an assessment or a submission type assignment

  • Name
    is_locked
    Type
    boolean
    Description

    Only teachers/admins with access to the course can lock the assignment. Locked assignments can't be completed by students.

  • Name
    created_at
    Type
    string
    Description

    Timestamp of when the assignment was created. Generated automatically at creation in ISO 8601 format.


POST/v1/assignments/create

Create an assignment

This endpoint allows you to create a new assignment.

Required parameters

  • Name
    course_id
    Type
    string
    Description

    Unique identifier for the course the assignment belongs to. Can't be changed after creation

  • Name
    title
    Type
    string
    Description

    Title of the assignment.

  • Name
    due_date
    Type
    string
    Description

    Date and time the assignment is due by

  • Name
    category
    Type
    string
    Description

    Shows if the assignment is "MINOR", "MAJOR", or "PRACTICE". The category of the assignment shows how much or how little it can affect the overall grade of a course

  • Name
    max_grade
    Type
    number
    Description

    Max score an assignment can have. Will affect the max_grade of the course it belongs to when being made or changed.

  • Name
    type
    Type
    string
    Description

    Shows if the assignment is an assessment or a submission type assignment

  • Name
    is_locked
    Type
    boolean
    Description

    Only teachers/admins with access to the course can lock the assignment. Locked assignments can't be completed by students.

Optional parameters

  • Name
    id
    Type
    string
    Description

    Unique identifier for the assignment.

  • Name
    description
    Type
    string
    Description

    Describe what the assignment is about or what needs to be done.

Request

POST
/v1/assignments/create
import ApiClient from '@example/protocol-api'

const client = new ApiClient(token)

await client.assignments.createAssignment({
  id: "03792e42-c9f1-4097-88f0-1856a0451ec3",
  course_id: "0215c090-6c68-46ee-932e-47be4c8e4a76",
  title: "Linear equations worksheet",
  description: "Finish problems 15-25",
  due_date: "2024-07-07T23:59:59.999999+00:00",
  category: "MINOR",
  max_grade: 35,
  type: "SUBMISSION",
  is_locked: false
})

Response

{
  "id": "03792e42-c9f1-4097-88f0-1856a0451ec3",
  "course_id": "0215c090-6c68-46ee-932e-47be4c8e4a76",
  "title": "Linear equations worksheet",
  "description": "Finish problems 15-25",
  "due_date": "2024-07-07T23:59:59.999999+00:00",
  "category": "MINOR",
  "max_grade": 35,
  "type": "SUBMISSION",
  "is_locked": false,
  "created_at": "2024-07-04T11:30:26.976408+00:00",
}

GET/v1/assignments/:id

Retrieve an assignment

This endpoint allows you to retrieve a assignment by providing the assignment id. Refer to the list at the top of this page to see which properties are included with assignment objects.

Request

GET
/v1/assignments/03792e42-c9f1-4097-88f0-1856a0451ec3
import ApiClient from '@example/protocol-api'

const client = new ApiClient(token)

await client.assignments.getAssignment('03792e42-c9f1-4097-88f0-1856a0451ec3')

Response

{
  "id": "03792e42-c9f1-4097-88f0-1856a0451ec3",
  "course_id": "0215c090-6c68-46ee-932e-47be4c8e4a76",
  "title": "Linear equations worksheet",
  "description": "Finish problems 15-25",
  "due_date": "2024-07-07T23:59:59.999999+00:00",
  "category": "MINOR",
  "max_grade": 35,
  "type": "SUBMISSION",
  "is_locked": false,
  "created_at": "2024-07-04T11:30:26.976408+00:00",
}

PATCH/v1/assignments/update/:id

Update an assignment

This endpoint allows you to perform an update on an assignment. All properties except the course_id and created_at can be changed.

Optional parameters

  • Name
    id
    Type
    string
    Description

    Unique identifier for the assignment.

  • Name
    title
    Type
    string
    Description

    Title of the assignment.

  • Name
    description
    Type
    string
    Description

    Describe what the assignment is about or what needs to be done.

  • Name
    due_date
    Type
    string
    Description

    Date and time the assignment is due by.

  • Name
    category
    Type
    string
    Description

    Shows if the assignment is major, minor, or practice. The category of the assignment shows how much or how little it can affect the overall grade of a course

  • Name
    max_grade
    Type
    number
    Description

    Max score an assignment can have. Will affect the max_grade of the course it belongs to when being made or changed.

  • Name
    type
    Type
    string
    Description

    Shows if the assignment is an assessment or a submission type assignment

  • Name
    is_locked
    Type
    boolean
    Description

    Only teachers/admins with access to the course can lock the assignment. Locked assignments can't be completed by students.

Request

PUT
/v1/assignments/update/03792e42-c9f1-4097-88f0-1856a0451ec3
import ApiClient from '@example/protocol-api'

const client = new ApiClient(token)

await client.assignments.updateAssignment('03792e42-c9f1-4097-88f0-1856a0451ec3', {
    description: "Finish problems 15-30"
})

Response

{
  "id": "03792e42-c9f1-4097-88f0-1856a0451ec3",
  "course_id": "0215c090-6c68-46ee-932e-47be4c8e4a76",
  "title": "Linear equations worksheet",
  "description": "Finish problems 15-30",
  "due_date": "2024-07-07T23:59:59.999999+00:00",
  "category": "MINOR",
  "max_grade": 35,
  "type": "SUBMISSION",
  "is_locked": false,
  "created_at": 692233200,
}

DELETE/v1/assignments/delete/:id

Delete an assignment

This endpoint allows you to delete assignments from a course. Note: This will permanently delete the assignment.

Request

DELETE
/v1/assignments/delete/03792e42-c9f1-4097-88f0-1856a0451ec3
import ApiClient from '@example/protocol-api'

const client = new ApiClient(token)

await client.assignments.deleteAssignment('03792e42-c9f1-4097-88f0-1856a0451ec3')



Statistics and Analytics


GET/v1/assignments/average/:id

Retrieve an average

This endpoint gets the average grade of an assignment based on all the students that have turned in the assignment rounded to the nearest hundredth.

Request

GET
/v1/assignments/average/03792e42-c9f1-4097-88f0-1856a0451ec3
import ApiClient from '@example/protocol-api'

const client = new ApiClient(token)

await client.assignments.getAverage('03792e42-c9f1-4097-88f0-1856a0451ec3')

Response

{
  "id": "03792e42-c9f1-4097-88f0-1856a0451ec3",
  "average": 85.83 
}

Was this page helpful?