async fn get_completions(
    req: HttpRequest,
    course_id_slug_or_code: Path<String>,
    pool: Data<PgPool>,
    query: Query<GetCompletionsQueryParamers>
) -> ControllerResult<HttpResponse>
Expand description

GET /api/v0/study-registry/completions/[:course_id | :uh_course_code | :course_slug] – Get completions from all modules in a course.

Gets all course completions for a given course. The course identifier can either be its University of Helsinki course code, or a system-local slug or hash id.

This endpoint is only available to authorized study registries, and requires a valid authorization token to access. Results are also streamed rather than included in the response body. In case of an error during transmission, an error message will be appended to the end of the broken stream output.

This endpoint returns an array of StudyRegistryCompletion structs.

Excluding already registering completions.

If the study registry has already registered some completions, it can exclude them from the results. This is achieved by adding a query parameter ?exclude_already_registered=true to the request. The value of the parameter is a boolean, and it defaults to false.

Example requests

Using University of Helsinki course code:

GET /api/v0/study-registry/completions/BSCS1001 HTTP/1.1
Authorization: Basic documentationOnlyExampleSecretKey-12345

Using course slug:

GET /api/v0/study-registry/completions/introduction-to-programming HTTP/1.1
Authorization: Basic documentationOnlyExampleSecretKey-12345

Using course id:

GET /api/v0/study-registry/completions/b3e9575b-fa13-492c-bd14-10cb27df4eec HTTP/1.1
Authorization: Basic documentationOnlyExampleSecretKey-12345

Exclude already registereed:

GET /api/v0/study-registry/completions/BSCS1001?exlcude_already_registered=true HTTP/1.1
Authorization: Basic documentationOnlyExampleSecretKey-12345

Response TypeScript definition

type Vec<StudyRegistryCompletion> = Array<{
  completion_date: string
  completion_language: string
  completion_registration_attempt_date: string | null
  email: string
  grade: StudyRegistryGrade
  id: string
  user_id: string
  tier: number | null
}>

Example response

[
  {
    "completion_date": "2022-06-21T00:00:00Z",
    "completion_language": "en-US",
    "completion_registration_attempt_date": null,
    "email": "student@example.com",
    "grade": {
      "scale": "sis-0-5",
      "grade": "4"
    },
    "id": "633852ce-c82a-4d60-8ab5-28745163f6f9",
    "user_id": "307fa56f-9853-4f5c-afb9-a6736c232f32",
    "tier": null
  }
]