Search code examples
jsonrestgoogle-classroom

Google Classroom Restful API - TurnIn Assignments


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).

I've managed to list the student's courses, coursework and submissions using the Rest services. However, I'm finding it impossible to update the student's answer when using the Patch method (https://developers.google.com/classroom/reference/rest/v1/courses.courseWork.studentSubmissions/patch) to try and update Submission Data.

As of now I'm using the following body for my patch calls:

   {
      "courseId": "xxxxxxxx",
      "courseWorkId": "wwwwwwwww",
      "id": "sssssss",
      "userId": "wwwwwwwwwwwwwww",
      "creationTime": "2019-09-30T19:38:59.594Z",
      "updateTime": "2019-09-30T19:38:59.561Z",
      "state": "CREATED",
      "alternateLink": "https://classroom.google.com/c/aaa/sa/aaaa/submissions/student/aaaa",
      "courseWorkType": "SHORT_ANSWER_QUESTION",
      "shortAnswerSubmission": 
      {
         "answer":"Test Answer"
      }
    }

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

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!


Solution

  • Confirmed that Path is a method used just for teachers to post their evaluation. The only way to send student data using Google Classroom is through Attachments (actually their link) using a normal assignment.