Skip to content

Add a /api/v3/enrollments/ API with reduced footprint#3303

Open
rhysyngsun wants to merge 2 commits intomainfrom
nl/user-enrollments-v3
Open

Add a /api/v3/enrollments/ API with reduced footprint#3303
rhysyngsun wants to merge 2 commits intomainfrom
nl/user-enrollments-v3

Conversation

@rhysyngsun
Copy link
Collaborator

@rhysyngsun rhysyngsun commented Feb 18, 2026

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/9559

Description (What does it do?)

This adds a /api/v3/enrollments/ API that is read-only for now and returns a very limited amount of information for now to keep it performant.

It also reworks the fixtures to make them easier to configure and to give guarantees of how many enrollments a user will get (previously it could be as few as 1 which made it harder to detect N+1 errors).

How can this be tested?

Tests should pass, you should be able to access the API /api/v3/enrollments and it return similar data to `/api/v2/enrollments, but with some problematic fields removed and much more performant.

@github-actions
Copy link

github-actions bot commented Feb 18, 2026

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:
4 changes: 0 error, 0 warning, 4 info
info	[endpoint-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v0.yaml	
	in API POST /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v0.yaml	
	in API DELETE /api/v3/enrollments/{id}/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v3/enrollments/{id}/
		endpoint added



## Changes for v1.yaml:
4 changes: 0 error, 0 warning, 4 info
info	[endpoint-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v1.yaml	
	in API POST /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v1.yaml	
	in API DELETE /api/v3/enrollments/{id}/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v3/enrollments/{id}/
		endpoint added



## Changes for v2.yaml:
4 changes: 0 error, 0 warning, 4 info
info	[endpoint-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v2.yaml	
	in API POST /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v2.yaml	
	in API DELETE /api/v3/enrollments/{id}/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v3/enrollments/{id}/
		endpoint added



Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@rhysyngsun rhysyngsun force-pushed the nl/user-enrollments-v3 branch 2 times, most recently from 0f11676 to 0c360ba Compare March 2, 2026 14:26
@rhysyngsun rhysyngsun force-pushed the nl/user-enrollments-v3 branch from 0c360ba to 6c78b83 Compare March 9, 2026 18:06
@rhysyngsun rhysyngsun marked this pull request as ready for review March 9, 2026 18:11
@rhysyngsun rhysyngsun force-pushed the nl/user-enrollments-v3 branch from 6c78b83 to 626ea91 Compare March 9, 2026 18:36
@rhysyngsun rhysyngsun force-pushed the nl/user-enrollments-v3 branch from 626ea91 to 141a583 Compare March 9, 2026 18:39
@rhysyngsun rhysyngsun force-pushed the nl/user-enrollments-v3 branch from 291e7fe to b095a90 Compare March 9, 2026 18:54
Copy link
Contributor

@gumaerc gumaerc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@annagav I generated the API client library against this branch and loaded it into my instance of Learn. After switching everything over to use the V3 enrollments endpoint, I noticed no differences versus V2. I'm sure there are performance improvements, but but it wasn't super noticeable as I recently wiped my workstation and don't have a ton of test data. I'd say the best way to test this is to get it out into the wild, then put up another PR to switch Learn over to it and we can test in RC / production against larger data sets. Either way, all the data we need to get in Learn is included here so we don't need to add anything else at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants