From f7e270b907a70df4effc0c817628d854432efec8 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Fri, 5 Aug 2022 17:12:30 -0400 Subject: [PATCH] feat!: change /api/v1/mfe_config to /api/mfe_config/v1 * 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". --- .../mfe_config_api/docs/decisions/0001-mfe-config-api.rst | 4 ++-- lms/djangoapps/mfe_config_api/views.py | 4 ++-- lms/urls.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/mfe_config_api/docs/decisions/0001-mfe-config-api.rst b/lms/djangoapps/mfe_config_api/docs/decisions/0001-mfe-config-api.rst index f9bd7e63617..8e298991186 100644 --- a/lms/djangoapps/mfe_config_api/docs/decisions/0001-mfe-config-api.rst +++ b/lms/djangoapps/mfe_config_api/docs/decisions/0001-mfe-config-api.rst @@ -18,7 +18,7 @@ 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. @@ -26,7 +26,7 @@ Decision Request:: - GET http://lms.base.com/api/v1/mfe_config?mfe=learning + GET http://lms.base.com/api/mfe_config/v1?mfe=learning Response:: diff --git a/lms/djangoapps/mfe_config_api/views.py b/lms/djangoapps/mfe_config_api/views.py index c124059406b..da875393dc6 100644 --- a/lms/djangoapps/mfe_config_api/views.py +++ b/lms/djangoapps/mfe_config_api/views.py @@ -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** ``` diff --git a/lms/urls.py b/lms/urls.py index 7bc6ba7062f..b1bb5a0539b 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -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')) ]