Page MenuHomeSoftware Heritage

Web API: add a /ping endpoint
Closed, MigratedEdits Locked

Description

It would be nice to have a /ping API endpoint, as a mnemonic one to test if the API is working, the current rate limit, etc.
The endpoint would do nothing except return "pong" (what else, right? :-))

Our documentation currently uses /stat/counters as an example in similar cases. /ping sounds nicer and could be used instead of that.

Revisions and Commits

Event Timeline

zack triaged this task as Low priority.Feb 25 2020, 10:55 AM
zack created this task.

Hi, I'd like to take this up :)

So, I'd simply have to make a new Django view in swh/web/api/views that returns the string 'pong' (besides appropriately calling the @api_route and @api_doc decorators and writing the appropriate docstring)?

Incidentally, is there a guide to hacking on the swh-web API? I could only find the API documentation

Hi, I'd like to take this up :)

So, I'd simply have to make a new Django view in swh/web/api/views that returns the string 'pong' (besides appropriately calling the @api_route and @api_doc decorators and writing the appropriate docstring)?

Incidentally, is there a guide to hacking on the swh-web API? I could only find the API documentation

@krithikvaidya, you got it right. Please follow these instructions to start hacking on swh source code.

Cool :-)

Please follow these instructions to start hacking on swh source code.

Yeah, I've done this ๐Ÿ‘ . I was talking about documentation specific to developing on the web API. For example, the different decorators (like @api_route, @format_document, etc.) available, guidelines on writing docstrings for this module, etc.

Anyways, I'll open a diff soon, thanks ๐Ÿ‘

Cool :-)

Please follow these instructions to start hacking on swh source code.

Yeah, I've done this ๐Ÿ‘ . I was talking about documentation specific to developing on the web API. For example, the different decorators (like @api_route, @format_document, etc.) available, guidelines on writing docstrings for this module, etc.

Anyways, I'll open a diff soon, thanks ๐Ÿ‘

You can find Python API documentation for swh-web here. Otherwise, you can inspire from the /stat/counters/ implementation. Please note that currently, we use [[ https://sphinxcontrib-httpdomain.readthedocs.io/en/stable/ | sphinxcontrib-httpdomain ]] format to document the API endpoints.