diff --git a/docs/source/user/api.rst b/docs/source/user/api.rst index 8c693760..5375094e 100644 --- a/docs/source/user/api.rst +++ b/docs/source/user/api.rst @@ -766,3 +766,22 @@ When using this strategy, in the response you can find the field (example: ``[['username', 'password'], ['sample_user', 'BBuOb5sN']]``) and the field ``pdf_link`` which can be used to download a PDF file containing the user credentials. + +Batch CSV Download +------------------- + +.. code-block:: text + + /api/v1/radius/organization//batch//csv/ + +Responds only to **GET**. + +Parameters: + +=============== =============================== +Param Description +=============== =============================== +slug string +id string +filename string +=============== =============================== diff --git a/openwisp_radius/base/models.py b/openwisp_radius/base/models.py index beb3675f..84b49830 100644 --- a/openwisp_radius/base/models.py +++ b/openwisp_radius/base/models.py @@ -830,7 +830,13 @@ def __str__(self): def _get_csv_file_location(instance, filename): - return os.path.join(str(instance.organization.pk), filename) + return os.path.join( + str(instance.organization.slug), + 'batch', + str(instance.organization.pk), + 'csv', + filename, + ) class AbstractRadiusBatch(OrgMixin, TimeStampedEditableModel): diff --git a/openwisp_radius/settings.py b/openwisp_radius/settings.py index 609b2686..bd897659 100644 --- a/openwisp_radius/settings.py +++ b/openwisp_radius/settings.py @@ -135,7 +135,7 @@ def get_settings_value(option, default): ) # Path of urls that need to be refered in migrations files. -CSV_URL_PATH = 'api/v1/radiusbatch/csv/' +CSV_URL_PATH = 'api/v1/radius/organization/' CALLED_STATION_IDS = get_settings_value('CALLED_STATION_IDS', {}) CONVERT_CALLED_STATION_ON_CREATE = get_settings_value( 'CONVERT_CALLED_STATION_ON_CREATE', False