【发布时间】:2019-11-08 19:46:43
【问题描述】:
我正在尝试使用 Google Apps 脚本创建一个作业,并将其放在同样使用同一脚本创建的主题下。当没有指定 topicId 时,我创建作业没有问题,但是一旦我尝试指定 topicId ,我在运行脚本时收到以下错误:API call to chinese.courses.courseWork.create failed with错误:收到无效的 JSON 有效负载。未知名称“测试主题”
这是我的代码:
function makeStuff() {
var topic = {
name: "Test Topic"
};
Classroom.Courses.Topics.create(topic, "46088716060");
var TWS1 = {
title: "Test Worksheet 1",
state: "DRAFT",
materials: [
{
driveFile:{
driveFile: {
id: "1REOs1RYtyVTX67VnJezjWf-wm7HqDVexeaeiQL3-HvM",
},
shareMode: "STUDENT_COPY"
}
}
],
workType: "ASSIGNMENT",
topicId: {
name: "Test Topic"
}
};
Classroom.Courses.CourseWork.create(TWS1, "46088716060")
}
是否可以通过名称引用topicId,或者将脚本中创建的topicId编号分配给可以引用的变量?
【问题讨论】:
标签: google-apps-script google-classroom