Search code examples
apihttp-status-code-404patchgoogle-classroom

Try to patch TEXT in a Classroom announcements over API


I'm not able to change 'text' in an announcements using Google-Classroom API.

When I try to use the PATCH method I have the following error:

{
  "error": {
    "code": 400,
    "message": "updateMask: Non-supported update mask fields specified",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "updateMask",
            "description": "Non-supported update mask fields specified"
          }
        ]
      }
    ]
  }
}

request and updateMask

I send a updateMask 'text' and a text in request body.

When I try with the updateMask 'state,scheduledTime' I get a successful. Has anyone ever had this error?

References: https://developers.google.com/classroom/reference/rest/v1/courses.announcements/patch


Solution

  • I had the same issue. Despite what the documentation seems to indicate (that updateMask can be text), I couldn't get it to work.

    I got around it by creating a new post with the information from the announcement, and deleting the old announcement.

    This is probably what you did too.