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'
classmethod get_app_endpoints()[source]
classmethod add_doc_route(route, docstring, noargs=False, api_version='1', **kwargs)[source]

Add a route to the self-documenting API reference

swh.web.api.apiurls.api_route(url_pattern=None, view_name=None, methods=['GET', 'HEAD', 'OPTIONS'], throttle_scope='swh_api', api_version='1', checksum_args=None)[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