I am using Django REST Framework and django-rest-swagger library for building an API endpoints. I would like to group some API urls by custom attribute instead of URL.
For example I have API endpoints and would like to group them by functions:
# task list management
GET /api/tasks/known - get known tasks list with their parameters
GET /api/tasks - get last tasks list with their statuses
# Tasks by ID management
GET /api/task/12345 - get task result/status
DELETE /api/task/12345 - Revoke task
# Task by name management:
# MyTask123
GET /api/tasks/MyTask123 - get task info (parameters, etc)
POST /api/tasks/MyTask123 - async start new task
# MySuperShinyTask777
GET /api/tasks/MySuperShinyTask777 - get task info (parameters, etc)
POST /api/tasks/MySuperShinyTask777 - async start new task
# scheduled tasks management
GET /api/tasks/scheduled - get list of scheduled tasks
# manage exact scheduled tasks
POST /api/tasks/scheduled/MyTask123 - schedule new task
GET /api/tasks/scheduled/12345 - get scheduled task details
PUT /api/tasks/scheduled/12345 - change scheduled task
DELETE /api/tasks/scheduled/12345 - delete scheduled task
So I would like to show them grouped by roles. Now they grouped all only '/api/' and that's it.
In urls.py
I include it like this:
url(r'^api/', include('api.urls'), name='my-api-root'),
How can I do custom grouping for django-rest-swagger?