Skip to content

Commit

Permalink
feat!: change /api/v1/mfe_config to /api/mfe_config/v1
Browse files Browse the repository at this point in the history
* This changes the API's path. The reasoning is that this is Version 1 of
  the mfe_config API, not Version 1 of the LMS's entire API, so the v1
  should come after mfe_config.
* Why does this matter? Firstly, consistency. Secondly, it affects our
  generated API documentation. If you visited
  https://courses.edx.org/api-docs, you could see that the API was
  listed under "v1" instead of "mfe_config".
  • Loading branch information
kdmccormick authored and andrey-canon committed Jan 20, 2023
1 parent 0bba716 commit f7e270b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Decision
- A lightweight API will be created that returns the mfe configuration variables from the site configuration or django settings. `PR Discussion about django settings`_
- The API will be enabled or disabled using the setting ``ENABLE_MFE_CONFIG_API``.
- The API will take the mfe configuration in the ``MFE_CONFIG`` keyset in the site configuration (admin > site configuration > your domain) or in django settings.
- This API allows to consult the configurations by specific MFE. Making a request like ``/api/v1/mfe_config?mfe=mymfe`` will return the configuration defined in ``MFE_CONFIG_OVERRIDES["mymfe"]`` merged with the ``MFE_CONFIG`` configuration.
- This API allows to consult the configurations by specific MFE. Making a request like ``/api/mfe_config/v1?mfe=mymfe`` will return the configuration defined in ``MFE_CONFIG_OVERRIDES["mymfe"]`` merged with the ``MFE_CONFIG`` configuration.
- The API will have a mechanism to cache the response with ``MFE_CONFIG_API_CACHE_TIMEOUT`` variable.
- The API will live in lms/djangoapps because this is not something Studio needs to serve and it is a lightweight API. `PR Discussion`_
- The API will not require authentication or authorization.
- The API request and response will be like:

Request::

GET http://lms.base.com/api/v1/mfe_config?mfe=learning
GET http://lms.base.com/api/mfe_config/v1?mfe=learning

Response::

Expand Down
4 changes: 2 additions & 2 deletions lms/djangoapps/mfe_config_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def get(self, request):
**Usage**
Get common config:
GET /api/v1/mfe_config
GET /api/mfe_config/v1
Get app config (common + app-specific overrides):
GET /api/v1/mfe_config?mfe=name_of_mfe
GET /api/mfe_config/v1?mfe=name_of_mfe
**GET Response Values**
```
Expand Down
2 changes: 1 addition & 1 deletion lms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,5 +1018,5 @@

# MFE API urls
urlpatterns += [
path('api/v1/mfe_config', include(('lms.djangoapps.mfe_config_api.urls', 'lms.djangoapps.mfe_config_api'), namespace='mfe_config_api'))
path('api/mfe_config/v1', include(('lms.djangoapps.mfe_config_api.urls', 'lms.djangoapps.mfe_config_api'), namespace='mfe_config_api'))
]

0 comments on commit f7e270b

Please sign in to comment.