Skip to content

docs: add ADR for standardizing REST API URL structure - #39003

Open
Abdul-Muqadim-Arbisoft wants to merge 1 commit into
openedx:masterfrom
edly-io:docs/ADR-standardize_rest_api_url_structure
Open

docs: add ADR for standardizing REST API URL structure#39003
Abdul-Muqadim-Arbisoft wants to merge 1 commit into
openedx:masterfrom
edly-io:docs/ADR-standardize_rest_api_url_structure

Conversation

@Abdul-Muqadim-Arbisoft

@Abdul-Muqadim-Arbisoft Abdul-Muqadim-Arbisoft commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Open edX REST URLs follow no consistent pattern. The /api/ prefix, the position of the version, pluralisation, word separators, and trailing slashes all vary, in places between adjacent lines of a single URLconf. The FC-0118 ADRs (0025-0037) standardize what happens inside an endpoint but never its address.

Add docs/decisions/0038-standardize-rest-api-url-structure.rst as an accepted ADR defining twelve rules: a leading /api/ prefix, singular API names with plural collections, domain-based rather than app-based naming, lowercase snake_case segments, mounts that declare their own prefix, exact-match routes with a required trailing slash, version position and form, hierarchy capped at one level of nesting, opaque-key identifiers resolved by shared path converters, verb-free resource paths, snake_case Django URL names, and a single URL namespace shared by the LMS and Studio. Existing endpoints migrate under OEP-21 with the conforming path mounted alongside the legacy one.

This restates the still-applicable rules from the Open edX REST API Conventions wiki that OEP-49 defers to, settles what that page left as TBD, and adds a CI conformance check so the convention is enforced rather than remembered.

Open edX REST URLs follow no consistent pattern. The /api/ prefix, the position
of the version, pluralisation, word separators, and trailing slashes all vary,
in places between adjacent lines of a single URLconf. The FC-0118 ADRs
(0025-0037) standardize what happens inside an endpoint but never its address.

Add docs/decisions/0038-standardize-rest-api-url-structure.rst as an accepted
ADR defining twelve rules: a leading /api/ prefix, singular API names with
plural collections, domain-based rather than app-based naming, lowercase
snake_case segments, mounts that declare their own prefix, exact-match routes
with a required trailing slash, version position and form, hierarchy capped at
one level of nesting, opaque-key identifiers resolved by shared path
converters, verb-free resource paths, snake_case Django URL names, and a single
URL namespace shared by the LMS and Studio. Existing endpoints migrate under
OEP-21 with the conforming path mounted alongside the legacy one.

This restates the still-applicable rules from the Open edX REST API Conventions
wiki that OEP-49 defers to, settles what that page left as TBD, and adds a CI
conformance check so the convention is enforced rather than remembered.

Findings recorded in the ADR:

- /api/courses/ is mounted in both services on unrelated implementations, both
  at v1, which blocks the endpoint-by-endpoint combined headless LMS+CMS
  migration.
- /api/enrollment/v1/enrollment and /api/enrollment/v1/enrollments/ are
  different views, so pluralisation is load-bearing today.
- Deprecated Org/Course/Run course keys contain slashes, so nesting one
  mid-path requires a shared path converter; the platform has three, in two
  apps, none reusable.
- Django resolves re_path with re.search, so unanchored patterns in
  course_experience and learner_home match under arbitrary prefixes.
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.

1 participant