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 JSON response from web app when main page is requested with Content-Type: application/json #637

Closed
ml-evs opened this issue Mar 10, 2024 · 2 comments · Fixed by #750
Closed

Comments

@ml-evs
Copy link
Member

ml-evs commented Mar 10, 2024

This would be very helpful for resolving the underlying API URL for users of the Python API. They may only "know" about e.g., datalab.odbx.science but the API will need to be passed api.odbx.science.

The web app should therefore have a JSON version of its root page that simply returns e.g., {"api_url": "<datalab_api_url>"} (and potentially some other metadata, like the description/owner of the datalab).

@ml-evs
Copy link
Member Author

ml-evs commented Apr 5, 2024

As discussed, probably want to hack the webapp/public/index.html to respond with some kind of structured response that the Python API can use to redirect when requested with HTTP header Content-Type: application/json

@ml-evs
Copy link
Member Author

ml-evs commented Apr 16, 2024

This turned out to be impossible -- potential workaround: add a meta field to HTML header that can be parsed by the Python.

<meta name="x-datalab-api-url" content="${{ VUE_APP_API_URL }}">

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

Successfully merging a pull request may close this issue.

2 participants