Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an HTML endpoint for /api with interactive docs #1418

Open
bollwyvl opened this issue May 2, 2024 · 3 comments
Open

Add an HTML endpoint for /api with interactive docs #1418

bollwyvl opened this issue May 2, 2024 · 3 comments

Comments

@bollwyvl
Copy link
Contributor

bollwyvl commented May 2, 2024

References

Problem

Finding the docs for the REST API is semi-annoying, and then not particularly interactive.

Proposed Solution

If a user visits e.g. http://127.0.0.1:8888/api in a browser, show them an interactive HTML application (that we don't have to write).

Additional context

This could be achieved by sniffing the accept header on /api in .

The static assets could be provisioned via (likely) some additional npm packages and a small jinja template to inject client settings (e.g. _xsrf).

We ship the OpenAPI Specification for the Jupyter Server REST API. There are a number of static HTML apps that consume OpenAPI specs, and present the spec as human-centric UI, and can also make live requests via JS. Some examples:

This could be demonstrated initially with an extension.

A longer term play would be to build this type of content with the modern Jupyter Client framework, such that it would inherit local theme options.

@bollwyvl bollwyvl changed the title Add an HTML endpoint for /api with docs Add an HTML endpoint for /api with interactive docs May 2, 2024
@manics
Copy link
Contributor

manics commented May 2, 2024

We recently switched to redoc for the JupyterHub API on readthedocs: https://jupyterhub.readthedocs.io/en/latest/reference/rest-api.html
I think it looks quite nice! It works in the way you say- the HTML code is pretty minimal, it's javascript that fetches the openapi spec https://jupyterhub.readthedocs.io/en/latest/_static/rest-api.yml and renders it.

@bollwyvl
Copy link
Contributor Author

bollwyvl commented May 2, 2024

Sure, can take a look at redoc first. They kinda push the veal with their premium product, but if it does the job, and the open source variant isn't too crippled...

bollwyvl added a commit to bollwyvl/jupyter_server that referenced this issue May 2, 2024
bollwyvl added a commit to bollwyvl/jupyter_server that referenced this issue May 2, 2024
bollwyvl added a commit to bollwyvl/jupyter_server that referenced this issue May 3, 2024
@bollwyvl bollwyvl mentioned this issue May 3, 2024
2 tasks
@bollwyvl
Copy link
Contributor Author

bollwyvl commented May 3, 2024

#1419 is ready for review: a lot of author doubt in there, and open to ways forward, with a personal bias toward first-party extension and jupyter_server[apidocs] shout-out from this repo (and placeholder content).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants