Google Classroom API Create Material

2020-08-01 07:37发布

问题:

I am aware that there are multiple questions essentially asking the same thing, but part of the problem I've identified is a lack of detail in the questions, so I'm going to try here, since I think I've exhausted all possibilities.

In the newer Google Classroom, there is a Classwork Tab/Page. This is new, and replaced an older "About" page. In this page, as a regular web user, you can create various materials, including one simply called "Material." This is done by clicking the create button and choosing "Material".

These materials contain any combination of title, description, and attached files/links.

However, when using the API, while I can access any OTHER type of Classwork via: Classroom.Courses.CourseWork, no attempts to find these items (or create them via the API) has been successful. I've successfully created Assignments (a variant of CourseWork using:


Classroom.Courses.CourseWork.create({
    "creatorUserId":'me',
    "state":'draft',
    "courseId":cid,
    "title":'test item',
    "workType":"ASSIGNMENT",
    "materials": [],

  }, 'myClassCode');

}

The enum for workType according to the API only contains:

I've tried omitting the workType (receive error saying I need to include it), using various guesses like MATERIAL, NONE, ABOUT, and null (all receive errors for invalid types).

I can query the list of CourseWork and find all of my entries that are questions or assignments but have found no access to the other items, which are current and active in the Classwork page for the class.

It's possible that this simply isn't accessible via the API, but I'd like to confirm. Any advice would be appreciated.

I am running as SuperUser and everything else seems to be working fine.

回答1:

You are right, at the moment it is not possible to create course materials through Google Classroom API.

Indeed, there is a feature request for it already:

https://issuetracker.google.com/issues/127591179

I suggest you to give it a star to increase visibility and get updates on the implementation status of the feature.