I am working on an app that is uploading data to Google Classroom using AppScript. I use two methods a lot:
/*
*@description adding grade to the submission
*@param courseId {string} id of clasroom in which there is coursework that we are intrested in
*@param courseWorkId {string} id of coursework in which there is submission that we are intrested in
*@param submId {string} submission id of submission to which we want to set mark*/
function setMark(courseId, courseWorkId, submIdd, mark) {
var maark = parseFloat(mark) || 0
if (maark < 0) {
maark = 0
}
var studentSubmissionRes = {
'assignedGrade': maark,
'draftGrade': maark
}
var extra = {
'updateMask': 'assignedGrade,draftGrade'
};
Classroom.Courses.CourseWork.StudentSubmissions.patch(studentSubmissionRes,
courseId, courseWorkId, submIdd, extra)
}
/**
*@description addind link to the submission
*@param fileUrl {string} url of file we want to add to submission
*@param courseId {string} id of clasroom in which there is coursework that we are intrested in
*@param courseWorkId {string} id of coursework in which there is submission that we are intrested in
*@param submId {string} submission id of submission to which we want to add the link
*/
function setLinkTosubmission(fileUrl, courseId, courseWorkId, submId) {
var request = ModifyAttachmentsRequest = {
'addAttachments': [{
'link': {
'url': fileUrl
}
}]
}
Classroom.Courses.CourseWork.StudentSubmissions.modifyAttachments(request, courseId, courseWorkId, submId)
}
Both of them work, but i would like to improve performance and batch requests to add link or grade, as is possible in Google Sheets API, but I cannot find a way to do this.
Also, is there a possibility to batch update text in many documents in at once?
P.S. I asked It also previously on stack overflow I got good answer Hovewer this answer used Global HTTP Batch Endpoints which will cease to work