首页 > 解决方案 > 通过 API Google Classroom 获取课程的“主题”价值

问题描述

如何在 API 中获取或更新课程的“主题”值?我在文档中没有找到任何相关信息

https://developers.google.com/classroom/reference/rest/v1/courses/get?authuser=1

标签: google-classroom

解决方案


编辑

正如 R1KO 指出的那样,当您填写课程时,会有一个单独的主题字段。

在此处输入图像描述

courses但是,从下面对象的完整响应中可以看出,API 中没有这样的字段

我已经调用了更多端点以查看它是否被埋在其他地方,但我找不到它。然而,查看问题跟踪器,发现了这个功能请求:

为课程添加主题

https://issuetracker.google.com/156289085

因此,此时您似乎可以做的最好的事情就是点击该功能中的 ☆ 按钮,让 Google 知道您需要此功能。


“主题”是 API 中的“名称”

这是整个courses对象:

{
  "id": string,
  "name": string,
  "section": string,
  "descriptionHeading": string,
  "description": string,
  "room": string,
  "ownerId": string,
  "creationTime": string,
  "updateTime": string,
  "enrollmentCode": string,
  "courseState": enum (CourseState),
  "alternateLink": string,
  "teacherGroupEmail": string,
  "courseGroupEmail": string,
  "teacherFolder": {
    object (DriveFolder)
  },
  "courseMaterialSets": [
    {
      object (CourseMaterialSet)
    }
  ],
  "guardiansEnabled": boolean,
  "calendarId": string
}

字段说明name如下:

课程名称。例如,“10 年级生物学”。名称是必需的。它必须介于 1 到 750 个字符之间,并且是有效的 UTF-8 字符串。

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

您可以通过以下GET请求获得此信息:

https://developers.google.com/classroom/reference/rest/v1/courses/get

要获取上面列出的所有字段,请确保包含*为 fields 参数。

UPDATEor更新PATCH

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


推荐阅读