swh.web.api.apiurls module¶
-
class
swh.web.api.apiurls.
APIUrls
[source]¶ Bases:
swh.web.common.urlsindex.UrlsIndex
Class to manage API documentation URLs.
Indexes all routes documented using apidoc’s decorators.
Tracks endpoint/request processing method relationships for use in generating related urls in API documentation
-
scope
= 'api'¶
-
swh.web.api.apiurls.
api_route
(url_pattern: str, view_name: Optional[str] = None, methods: List[str] = ['GET', 'HEAD', 'OPTIONS'], throttle_scope: str = 'swh_api', api_version: str = '1', checksum_args: Optional[List[str]] = None, never_cache: bool = False)[source]¶ Decorator to ease the registration of an API endpoint using the Django REST Framework.
- Parameters
url_pattern – the url pattern used by DRF to identify the API route
view_name – the name of the API view associated to the route used to reverse the url
methods – array of HTTP methods supported by the API route
throttle_scope – Named scope for rate limiting
api_version – web API version
checksum_args – list of view argument names holding checksum values
never_cache – define if api response must be cached