Students

This page will go into detail on the properties of the students class as well as the different endpoints used to query, create, update, and delete students.

The student model

This model details all of the properties of a student as well as their references

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the student.
    References: auth.user.id.

  • Name
    first_name
    Type
    string
    Description

    The first name of the student.

  • Name
    middle_name
    Type
    string
    Description

    The middle name of the student. Is optional.

  • Name
    last_name
    Type
    string
    Description

    The last name of the student.

  • Name
    birthday
    Type
    date
    Description

    The birthday of the student stored in YYYY-MM-DD format.

  • Name
    school
    Type
    string
    Description

    The school the student currently goes to.

  • Name
    grade_level
    Type
    int
    Description

    The grade level of the student. 0 is used for kindergarten.

  • Name
    created_at
    Type
    string
    Description

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


POST/v1/student/create

Create a student

This endpoint allows you to add a new student to the database. To add a student, you must provide a proper Student object as the request body.

Required parameters

  • Name
    id
    Type
    string
    Description

    Unique identifier for the student.
    References: auth.user.id.

  • Name
    first_name
    Type
    string
    Description

    The first name of the student.

  • Name
    last_name
    Type
    string
    Description

    The last name of the student.

  • Name
    birthday
    Type
    date
    Description

    The birthday of the student stored in YYYY-MM-DD format.

  • Name
    school
    Type
    string
    Description

    The school the student currently goes to.

  • Name
    grade_level
    Type
    int
    Description

    The grade level of the student. 0 is used for kindergarten.

Optional parameters

  • Name
    middle_name
    Type
    string
    Description

    The middle name of the student. Default is null.

Request

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

const client = new ApiClient(token)

await client.student.createStudent({
  id: "627a64c9-645a-491f-a851-b59331248af7",
  first_name: "Bob",
  middle_name: "Norman",
  last_name: "Ross",
  birthday: new Date(1942, 10, 29)
  school: "PHHS",
  grade_level: 12
})

Response

{
  "id": "627a64c9-645a-491f-a851-b59331248af7",
  "first_name": "Bob",
  "middle_name": "Norman",
  "last_name": "Ross",
  "birthday": "1942-10-29",
  "school": "PHHS",
  "grade_level": 12,
  "created_at": "2024-07-04T11:32:23.976408+00:00"
}

GET/v1/student/:id

Retrieve a student

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

Request

GET
/v1/student/627a64c9-645a-491f-a851-b59331248af7
import ApiClient from '@example/protocol-api'

const client = new ApiClient(token)

await client.student.getStudent('627a64c9-645a-491f-a851-b59331248af7')

Response

{
  "id": "627a64c9-645a-491f-a851-b59331248af7",
  "first_name": "Bob",
  "middle_name": "Norman",
  "last_name": "Ross",
  "birthday": "1942-10-29",
  "school": "PHHS",
  "grade_level": 12,
  "created_at": "2024-07-04T11:32:23.976408+00:00"
}

PATCH/v1/student/update/:id

Update a student

This endpoint allows you to perform an update on a student. All properties except for created_at and id can be changed

Optional parameters

  • Name
    first_name
    Type
    string
    Description

    The first name of the student.

  • Name
    middle_name
    Type
    string
    Description

    The middle name of the student. Is optional.

  • Name
    last_name
    Type
    string
    Description

    The last name of the student.

  • Name
    birthday
    Type
    date
    Description

    The birthday of the student stored in YYYY-MM-DD format.

  • Name
    school
    Type
    string
    Description

    The school the student currently goes to.

  • Name
    grade_level
    Type
    int
    Description

    The grade level of the student. 0 is used for kindergarten.

Request

PATCH
/v1/student/update/627a64c9-645a-491f-a851-b59331248af7
import ApiClient from '@example/protocol-api'

const client = new ApiClient(token)

await client.student.update('627a64c9-645a-491f-a851-b59331248af7', {
    first_name: 'Robert',
})

Response

{
  "id": "627a64c9-645a-491f-a851-b59331248af7",
  "first_name": "Robert",
  "middle_name": "Norman",
  "last_name": "Ross",
  "birthday": "1942-10-29",
  "school": "PHHS",
  "grade_level": 12,
  "created_at": "2024-07-04T11:32:23.976408+00:00"
}

DELETE/v1/student/delete/:id

Delete a student

This endpoint allows you to delete a specified student using their id. This will also delete any grades associated with this student.

Request

DELETE
/v1/student/627a64c9-645a-491f-a851-b59331248af7
import ApiClient from '@example/protocol-api'

const client = new ApiClient(token)

await client.student.delete('627a64c9-645a-491f-a851-b59331248af7')



Student Performance


GET/v1/student/gpa/:id

Calculate student GPA

This endpoint calculates the gpa of a student to the nearest hundredth. GPA is calculated based on the letter grades of the student's courses and the total number of credits for those courses. For more information visit pages 44-45 of the BCPS Grading and Reporting Procedures Manual.

Request

GET
/v1/student/gpa/:id
import ApiClient from '@example/protocol-api'

const client = new ApiClient(token)

await client.student.calculateGpa('627a64c9-645a-491f-a851-b59331248af7')

Response

{
  "studentId": "627a64c9-645a-491f-a851-b59331248af7",
  "gpa": 3.84
}

GET/v1/student/qpa/:id

Calculate student QPA

This endpoint calculates the qpa of a student to the nearest hundredth. QPA is calculated based on the letter grades of the student's courses, the total number of credits for those courses, and the levels of those courses. For more information visit pages 44-45 of the BCPS Grading and Reporting Procedures Manual.

Request

GET
/v1/student/qpa/:id
import ApiClient from '@example/protocol-api'

const client = new ApiClient(token)

await client.student.calculateQpa('627a64c9-645a-491f-a851-b59331248af7')

Response

{
  "studentId": "627a64c9-645a-491f-a851-b59331248af7",
  "qpa": 5.24
}

Was this page helpful?