Using API to Create Groups Based on Number of Students and Have Unique Names

Community Member

Hi all - I posted this in the general question forum but realized this group might be a better place. Apologies if this was wrong to do. I'm not a developer per se, but I'm an instructional designer at a relatively large school. I am relatively new to tapping into Canvas APIs, but I think I am getting the hang of it. I use Postman primarily.

I am looking to create groups in sections of courses prior to course migration and I am running into two problems/questions I can't find answers to.

1) I would use the create group category call, but it generates groups that all have the same name as the group category. Some courses have groups with unique names (eg the group will be titled an assigned topic for the students, which will be different than the category title which might just be "Project Name"). So I was thinking I could create a group category with no groups, then use a different call to create the individual groups, and then after, run a call to assign unassigned members, which seems like it might work. Does that sound right?

2) The second problem I am having that I don't know how to resolve is that Canvas allows you to create however many groups are needed in order for there to be 4 students per group, for example (the option says "Split students into groups with X number of students per group"). Some of our courses use this option, and I can't see a way to get that to work through the API. When creating a group category, the parameter group_limit says "Limit the maximum number of users in each group (Course Only). Requires self signup." But I want it to be randomized and automatic when the category is created in the course, not self sign-up, and I want it to generate however many groups are needed for that section for there to be 4 students in each group. Since Canvas can do it, I'd assume there would be a way to do it through the API, but I can't find documentation on it.

I saw that there is an option to export groups from an existing course and then import them, but since I am working from user-less templates for the copy process, it exports a blank data sheet.