diff --git a/swh/web/api/urls.py b/swh/web/api/urls.py --- a/swh/web/api/urls.py +++ b/swh/web/api/urls.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2018 The Software Heritage developers +# Copyright (C) 2017-2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -13,6 +13,7 @@ import swh.web.api.views.snapshot # noqa import swh.web.api.views.stat # noqa import swh.web.api.views.vault # noqa +import swh.web.api.views.ping # noqa from swh.web.api.apiurls import APIUrls diff --git a/swh/web/api/views/ping.py b/swh/web/api/views/ping.py new file mode 100644 --- /dev/null +++ b/swh/web/api/views/ping.py @@ -0,0 +1,27 @@ +# Copyright (C) 2020 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU Affero General Public License version 3, or any later version +# See top-level LICENSE file for more information + +from swh.web.api.apidoc import api_doc +from swh.web.api.apiurls import api_route + + +@api_route(r'/ping/', 'api-1-ping') +@api_doc('/ping/', noargs=True) +def ping(request): + """ + .. http:get:: /api/1/ping/ + + A simple test to check if the API is working. + + :statuscode 200: no error + + **Example:** + + .. parsed-literal:: + + :swh_web_api:`ping/` + + """ + return "pong"