You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用Google Classroom API注册课程作业推送通知出现参数绑定错误如何解决

这个报错是因为你调用classroomAPI.registrations.create方法时,没有将请求参数放在requestBody字段下,导致参数被识别为URL查询参数而非JSON请求体,服务端无法匹配到对应字段。

你原来的调用没有正确传递参数结构,调整为如下格式即可:

const CourseRegistration = await classroomAPI.registrations.create({
  requestBody: {
    "feed": {
      "feedType": "COURSE_WORK_CHANGES",
      "courseWorkChangesInfo": {
        "courseId": "courseidhere"
      }
    },
    "cloudPubsubTopic": {
      "topicName": "topicnamehere"
    }
  }
});

你还需要同步检查以下配置项,避免后续出现其他报错:

  • 授权凭证必须包含https://www.googleapis.com/auth/classroom.push-notifications权限范围
  • 你使用的Pub/Sub主题,需要提前为账号classroom-notifications@system.gserviceaccount.com授予发布者权限,否则后续无法正常接收推送
  • 填写的courseId必须为当前授权身份可访问的有效课程ID

内容的提问来源于stack exchange,提问作者strikeriv

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 16:06:08