canvas-lms
canvas-lms copied to clipboard
How to delete submission comment?
Hi,
I've been trying to use the Python API to delete submission comments (e.g., when my autograding needs a "fresh" start with all previously-updated scores/comments deleted). While I could not find a suitable Python call for this, I attempted to use the requests API detailed here: https://canvas.instructure.com/doc/api/submission_comments.html#method.submission_comments_api.destroy.
However, it does not work as there is no comments field in the resulting form data, despite my having put multiple "Test" comments there:
{
"id": (redacted),
"body": null,
"url": null,
"grade": "100",
"score": 100,
"submitted_at": null,
"assignment_id": (redacted),
"user_id": (redacted),
"submission_type": null,
"workflow_state": "graded",
"grade_matches_current_submission": true,
"graded_at": "2024-07-19T00:11:05Z",
"grader_id": (redacted),
"attempt": null,
"cached_due_date": "2024-09-20T05:59:59Z",
"excused": false,
"late_policy_status": null,
"points_deducted": null,
"grading_period_id": null,
"extra_attempts": null,
"posted_at": "2024-07-18T23:19:25Z",
"redo_request": false,
"custom_grade_status_id": null,
"sticker": null,
"late": false,
"missing": false,
"seconds_late": 0,
"entered_grade": "100",
"entered_score": 100,
"preview_url": "https://utah.instructure.com/courses/(redacted)/assignments/(redacted)/submissions/(redacted)?preview=1&version=4"
}
Can someone please advise me on the best way to "wipe" previous submission comments?