Skip to content

Simplify Content Groups API v2 Response Structure #37973

@brianjbuck-wgu

Description

@brianjbuck-wgu

Summary

The current Content Groups API v2 endpoint (/api/cohorts/v2/courses/{course_id}/group_configurations) returns an overly complex nested response structure that was designed for Studio's internal use. For the Instructor Dashboard, we need a simplified, flat response.

Current Response Structure

{                                                                                                                                                                                          
    "all_group_configurations": [                                                                                                                                                            
      {                                                                                                                                                                                      
        "id": 18587404,                                                                                                                                                                      
        "name": "Content Groups",                                                                                                                                                            
        "scheme": "cohort",                                                                                                                                                                  
        "groups": [                                                                                                                                                                          
          {"id": 1819362822, "name": "Content Group A", "version": 1, "usage": []},                                                                                                          
          {"id": 259161138, "name": "Test", "version": 1, "usage": []},                                                                                                                      
          {"id": 205150518, "name": "Content Group B", "version": 1, "usage": []}                                                                                                            
        ],                                                                                                                                                                                   
        ...                                                                                                                                                                                  
      }                                                                                                                                                                                      
    ],                                                                                                                                                                                       
    "context_course": null,                                                                                                                                                                  
    "course_outline_url": "...",                                                                                                                                                             
    "group_configuration_url": "...",                                                                                                                                                        
    "should_show_enrollment_track": false,                                                                                                                                                   
    "should_show_experiment_groups": true                                                                                                                                                    
  }  

Desired Response Structure

{
  "id": 18587404,
  "groups": [                                                                                                                                                                              
      {"id": 1819362822, "name": "Content Group A", "version": 1, "usage": []},
      {"id": 259161138, "name": "Test", "version": 1, "usage": []},
      {"id": 205150518, "name": "Content Group B", "version": 1, "usage": []}
    ],
  "studio_content_groups_link": "http://example-host.com/authoring/course/course-v1:org+course+run/group_configurations"
} 

Requirements

  1. Return a flat groups array containing just the content groups for the course
  2. Include studio_content_groups_link - a URL to Studio where instructors can create/manage content groups
  3. Always return both fields, even when groups is an empty array (so users can navigate to Studio to create their first content group)

Acceptance Criteria

  • API returns only groups and studio_content_groups_link fields
  • groups is a flat array of content group objects
  • studio_content_groups_link points to Studio's group configurations page
  • Response works correctly when no content groups exist (empty array)
  • Update serializers and views accordingly
  • Update API tests

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions