Skip to content

API URL Routing

Alexandar83 edited this page Feb 23, 2025 · 11 revisions

This page outlines how API URL routing is structured in The Wall API. It covers dynamic endpoint management and versioning.

1. API URL Structure and Configuration

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.


2. Dynamic Endpoint Management

To avoid hardcoding URLs throughout the codebase, all API paths are centrally defined in api_utils.exposed_endpoints.

Each entry consists of:

  • Path – The full API route, dynamically prefixed with the API version.
  • Name – The identifier used in Django’s URL dispatcher, dynamically suffixed with the API version for uniqueness.

This approach provides several benefits:

✔ Single source of truth → Updates only require modifications in one place.
✔ Consistent API structure → Maintains uniform naming and path conventions.
✔ Scalability → Facilitates seamless adaptation to future API versions.

3. API Versioning

The API applies URL-based versioning, defined in settings.py, using DRF’s URLPathVersioning.

  • The current supported version is v2.
  • Future versions can be added by updating the ALLOWED_VERSIONS list in settings.py.

Example API Requests

Request URL API Version
/api/v2/wallconfig-files/upload/ 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.


Next:   Authentication (Djoser)
Back to: DRF Configuration

Return to Top
DTS Index
Home Page


Clone this wiki locally