Function get_moss_report

Source
pub async fn get_moss_report(__arg0: Path<(i64, i64)>) -> impl IntoResponse
Expand description

GET /api/modules/{module_id}/assignments/{assignment_id}/plagiarism/moss

Retrieves metadata for the most recent MOSS report generated for the given assignment. Accessible only to lecturers and assistant lecturers assigned to the module.

This endpoint does not trigger a new MOSS run—it only returns the last stored report URL and its generation timestamp. To generate a new report, use the POST endpoint: /api/modules/{module_id}/assignments/{assignment_id}/plagiarism/moss.

§Path Parameters

  • module_id: The ID of the parent module
  • assignment_id: The ID of the assignment whose latest MOSS report should be fetched

§Request Body

None.

§Returns

  • 200 OK on success with the latest report metadata:
    • report_url — The external URL to the MOSS results page
    • generated_at — RFC 3339 timestamp for when the report file was written
  • 404 NOT FOUND if no report has been generated yet
  • 500 INTERNAL SERVER ERROR if the report file cannot be read or parsed

§Example Response (200 OK)

{
  "success": true,
  "message": "MOSS report retrieved successfully",
  "data": {
    "report_url": "http://moss.stanford.edu/results/123456789",
    "generated_at": "2025-05-30T12:34:56Z"
  }
}

§Example Response (404 Not Found)

{
  "success": false,
  "message": "MOSS report not found"
}

§Example Response (500 Internal Server Error)

{
  "success": false,
  "message": "Failed to read MOSS report: <reason>"
}

§Notes

  • Internally, the metadata is read from reports.txt under the assignment’s storage directory: .../module_{module_id}/assignment_{assignment_id}/reports.txt.
  • The report_url is hosted by the MOSS service and may expire per MOSS retention policy.
  • To refresh the report, run the POST /plagiarism/moss endpoint and then call this GET again.