Binderhub api endpoint: example and download files

Hi all,

As part of our workflow, we are triggering some additional component in binderhub (jupyter book build) after a successful user environment build, and we need a feedback from the cluster about the success of the build, launch etc…
Following the documentation BinderHub API Documentation — BinderHub 0.1.0 documentation, there is an api that can do that, however there is no working example.

Can you give me more details about how to request a user launch, and getting back a json formatted answer about the status?

We were also wondering if there is an easy way to request a download of the files that are inside the environment, through the api endpoint.

thank you,

Ok, I was able to use the api endpoint with curl on bash. For example github it would be something like:

curl -N https://BINDER-HOST/build/gh/GH_USER/REPO_NAME.git/HEAD

However to get the files form the user environment I am not sure yet, if this is possible.

There is an example script in the repo for using this API.

This bit is where the event stream messages are consumed to monitor progress and get the URL and token when it completes.


than you @minrk, this is also definitively usefull.

By any chance, do you know if it is possible to request a download link of a specific folder using the api ? It is possible to do it manually inside a notebook, by inserting this cell, but we would like to get it at runtime…

from IPython.display import FileLink
from shutil import make_archive
make_archive('sample', 'zip', "./_build")

The download link is /files/path/to/file, so /files/ in that example (relative to the server base prefix, i.e. /user/user-xyz/files/

1 Like