Google课堂api:继续获得400个无效参数

问题描述 投票:0回答:1

我正在使用google playground环境测试google教室api。每次我向此终端发出一个帖子请求:https://classroom.googleapis.com/v1/courses,我一直收到此错误:

{
  "error": {
    "status": "INVALID_ARGUMENT", 
    "message": "Request contains an invalid argument.", 
    "code": 400
  }
}

这是我发送到端点的POST主体:

{
  "id": "1234T",
  "name": "Physics 101",
  "section": "Period 2",
  "room": "101",
  "ownerId": "me"
}

我正在传递所有必要的项目,如Bearer令牌等,据我所知,我也在json体内传递必要的字段。是什么导致此错误,我该如何解决它。

google-apis-explorer google-classroom
1个回答
0
投票

原来问题是id字段在json对象中。一旦我删除它,它就开始工作了。以下链接中的doc似乎可以创建一个id作为别名,仍然有点混淆该过程,但这里是链接:https://developers.google.com/classroom/reference/rest/v1/courses#Course

© www.soinside.com 2019 - 2024. All rights reserved.