HTTP 405 when accessing Contents API from DataSpell

We are testing connecting to Jupyterhub on Kubernetes using DataSpell, but it looks like the API URLs aren’t quite as expected.

For example, the “configured server” in DataSpell is:
https://jupyterhub.myhost.com/?token=mysecretusertoken

Then when i create a file in DataSpell a 405 appears in the DataSpell logs:

2022-01-31 15:18:27,978 [1949333] ERROR - intellij.openapi.progress.Task - Error with connection to Jupyter: server responded with 405 on Request(method=PUT, uri=https://jupyterhub.myhost.com/api/contents/test.py-upload-24SzJvvFWJ50kWwMu5b0XZPDUyH, headers=[(Content-Type, application/json; charset=UTF-8)], body=java.io.ByteArrayInputStream@53c27d49, context=Context(mayInteractUi=true)). [200, 201] was expected.

Is it possible to connect to a Jupyterhub pod using an external IDE or am I barking up the wrong tree?

I’m not familiar with DataSpell, but it’s possible to access the jupyter-server API on JupyterHub. For example:

$ curl localhost:8000/user/demo/api/contents -H 'Authorization: token <token>'

{"name": "", "path": "", "last_modified": "2022-02-06T17:30:11.565506Z", "created": "2022-02-06T17:30:11.565506Z", "content": [], "format": "json", "mimetype": null, "size": null, "writable": true, "type": "directory"}

This assumes your jupyter-server is already running.

Thanks manics. I was hoping the API was just automatically compatible with whatever Dataspell expects in order to be able to share the notebook with the IDE. haha.

Do you have experience / recommendations for using any other external tools to sync with Jupyterhub on Kubernetes? Some of our users prefer using an external IDE instead of notebooks-in-a-browser.

I don’t, I usually use JupyterLab for editing notebooks :slight_smile: