google-api-go-client: Google Classroom Turn In API bad request error

Environment details

  • Programming language: Go
  • OS: Mac OS
  • Language runtime version: 1.19
  • Package version: google.golang.org/api/classroom/v1 , google.golang.org/api v0.87.0

Steps to reproduce

running this code snippet (given valid course id, coursework id and submission id…):

_,err = service.Courses.CourseWork.StudentSubmissions.TurnIn(submission.CourseID, submission.courseWorkID, submission.ID, &classroom.TurnInStudentSubmissionRequest{}).Context(ctx).Do()

gives this error:

googleapi: Error 400: Invalid JSON payload received. Unknown name "": Root element must be a message.
Details:
[
  {
    "@type": "type.googleapis.com/google.rpc.BadRequest",
    "fieldViolations": [
      {
        "description": "Invalid JSON payload received. Unknown name \"\": Root element must be a message."
      }
    ]
  }
]

I read the docs and found no information on what TurnInStudentSubmissionRequest is. It seem its only purpose is to provide an empty request body. So, my assumption is to just include an empty struct, but i am left with a 400 bad request error stating above issue.

Am I writing this call incorrectly?

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 24 (15 by maintainers)

Most upvoted comments

I’m on rotation now so I’ve looked into this. I have strong reason to believe that this is either an issue in the backend (not expecting a body when it should be) or a misconfiguration of their HTTP settings (those that ultimately serve the API and are used to generate this client library). I will open a bug internally and follow up here with y’all.

I already filed a bug internally, through which I hope to get an integration test setup to repro & debug with.

The Go client docs for TurnInStudentSubmissionRequest indeed show it as an empty struct. I will continue investigating.