Repository navigation
API URL Routing
This page outlines how API URL routing is structured in The Wall API. It covers dynamic endpoint management with api_utils.exposed_endpoints, global inclusion via config/urls.py, and versioning enforcement.
The Wall API follows a centralized approach to URL management, ensuring consistency and maintainability.
-
All API endpoints are registered in
the_wall_api/urls.py, where each route is mapped to a corresponding view. -
Global URL configuration is handled in
config/urls.py, which includes API routes under the/api/v2/namespace. -
API paths are not hardcoded — they are dynamically retrieved from
api_utils.exposed_endpoints, allowing seamless modifications.
This structure ensures scalability and reduces redundancy, making the API easier to maintain and extend.
To avoid hardcoding URLs throughout the codebase, all API paths are centrally defined in api_utils.exposed_endpoints.
Each entry consists of:
- Path – The actual API route.
- Name – The identifier used in Django’s URL dispatcher.
- Prefix – A dynamically set API version prefix, ensuring seamless API versioning and structured URL organization across all endpoints.
This approach provides several benefits:
✔ Single source of truth → Updates only require modifications in one file.
✔ Consistent API structure → Ensures uniform naming and path conventions.
✔ Easy version management → Facilitates future API updates without breaking existing routes.
The API applies URL-based versioning, defined in config/settings.py, using DRF’s URLPathVersioning.
- The current supported version is
v2. - Future versions can be added by updating the
ALLOWED_VERSIONSlist inconfig/settings.py.
| Request URL | API Version |
|---|---|
/api/v2/profiles/overview/ |
v2 |
/api/v2/profiles/overview/3/ |
v2 |
This ensures a structured approach to API versioning, allowing seamless transitions between versions as the API evolves.
💡 More details can be found in the API Access Overview.
← Back to: System Architecture | Next: Authentication (Djoser) →
Return to Top
DRF Index
DTS Index
Home Page
📌 Notable Technical Sections
👤 Author
LinkedIn: Aleksandar Dimitrov
Yahoo: sasho_1983@yahoo.com