问题描述
尝试在Google Apps脚本中使用Classroom API的StudentSubmissions.Patch部分,并继续运行此错误。
以下是我的代码:
var studentSubmission = {'draft_grade':'88'}
var patchC = Classroom.Courses.CourseWork.StudentSubmissions.patch(studentSubmission ,courseId,cwId,submissionId);
传递StudentSubmission资源参数的方式显然有问题,但我无法找出原因......
这显然是我所指的文件 -
UPDATE
我可以稍微更改一下代码,在说。显然,我并没有完全使用你们所说的,因为KENdi的例子是在Python和Ein2012中,它会在 var patchC = Classroom ... 行中出错。
我改变了一些现在看起来像这样的东西:
var studentSubmission = {'draftGrade': '88'}
var extra = {'updateMask':'draftGrade'};
var patchC = Classroom.Courses.CourseWork.StudentSubmissions.patch(studentSubmission,courseId,cwId,submissionId,extra);
但是现在我得到一个不同的错误@ProjectPermissionDenied开发者控制台项目不允许发出这个请求。所以,现在我不确定该格式是否正确,并且存在一些我尚未解决的开发者控制台情况(尽管感觉我是正确的),或者新格式不正确,我只是获得了狂野的许可错误。
我看到这个类似错误但是如果课程作业是通过课堂而不是通过脚本创建的,那该怎么办?指定更新掩码字段并稍后执行,并按文档中的说明指定名称(draftGrade,assignedGrade,指定的级别,分配的级别 )
var studentSubmission = {'draftGrade':'88'}
var patchC = Classroom.Courses.CourseWork .StudentSubmissions.patch(studentSubmission,courseId,cwId,submissionId);
patchC.UpdateMask =draftGrade;
var response = submisionObj.Execute();
Trying to use the StudentSubmissions.Patch part of the Classroom API in Google Apps Script and keeping running across this error
Here is my code for that particular section:
var studentSubmission = {'draft_grade':'88'}
var patchC = Classroom.Courses.CourseWork.StudentSubmissions.patch(studentSubmission, courseId, cwId, submissionId);
There is clearly something wrong with the way I am passing the StudentSubmission Resource parameter, but I can't figure out why...
This is clearly the documentation I am referring to - https://developers.google.com/classroom/reference/rest/v1/courses.courseWork.studentSubmissions/patch
UPDATE
I was able to change the code a bit to reflect what you both were saying. Obviously, I didn't use exactly what you both said because KENdi's example is in Python and Ein2012, it would error out on the var patchC = Classroom... line.
I changed some things that now look like this:
var studentSubmission = {'draftGrade':'88'}
var extra = {'updateMask':'draftGrade'};
var patchC = Classroom.Courses.CourseWork.StudentSubmissions.patch(studentSubmission, courseId, cwId, submissionId, extra);
But now I get a different error "@ProjectPermissionDenied The Developer Console project is not permitted to make this request". So, now I'm unsure if that formatting is correct and there is some Developer Console situation I haven't resolved (although feel as though I'm correct), or that new formatting is wrong and I'm just getting the wild permission error.
I saw this Similar Error but what if the course work was one created normally through classroom and not via a script? Ahh.
specify update mask fields and later execute and also specify names as instructed in the documentation ("draftGrade","assignedGrade")
var studentSubmission = {'draftGrade':'88'}
var patchC = Classroom.Courses.CourseWork.StudentSubmissions.patch(studentSubmission, courseId, cwId, submissionId);
patchC.UpdateMask = "draftGrade";
var response = submisionObj.Execute();
这篇关于StudentSubmissions.Patch UpdateMask错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!