0

I'm trying to use Google Classroom's Rest resources (https://developers.google.com/classroom/reference/rest/v1/courses.courseWork.studentSubmissions#StudentSubmission) to implement a student posting an answer to a "Simple Question" assignment (i.e.: An assignment which takes only a string as the answer) As of now I'm using the following body for my patch calls:

StudentSubmission studentSubmission = new StudentSubmission();
studentSubmission.setMultipleChoiceSubmission(new MultipleChoiceSubmission().setAnswer(answer));
classroomService.courses().courseWork().studentSubmissions().patch(courseId, courseWorkId, id, studentSubmission).execute();

And the result is an Error 400 - Invalid JSON payload received..

{
  "code": 400,
  "details": [
    {
      "@type": "type.googleapis.com/google.rpc.BadRequest"
    }
  ],
  "errors": [
    {
      "domain": "global",
      "message": "updateMask: updateMask may only contain \"draftGrade\" or \"assignedGrade\".",
      "reason": "badRequest"
    }
  ],

I can successfully submit the assignment using courses.courseWork.studentSubmissions.turnIn, but when submitting short answer and multiple choice questions, I end up submitting blank answers!

How do I submit answers to short answer and multiple choice questions through the classroom api.

Is there a way to make this happen - i.e.: for a third party software to update an answer from a student's assignment? Thanks in advance!

1 Answer 1

0

Is there a way to make this happen - i.e.: for a third party software to update an answer from a student's assignment?

Unfortunately, no.

Today you can only set the draftGrade and assignedGrade, as indicated by the error message about the field mask (only fields set-able in the field mask are written when a PATCH request is made).

There is an open request for this behavior here - https://issuetracker.google.com/issues/155218358. Please upvote and add any use case or explain how this feature (or lack of it) impacts your use case. The Classroom team uses this information to prioritize feature requests.

Not the answer you're looking for? Browse other questions tagged or ask your own question.