Skip to content
This repository has been archived by the owner on Oct 26, 2019. It is now read-only.

Server API

Javier Pedemonte edited this page Jul 27, 2016 · 9 revisions

List Dashboards

GET /dashboards/[PATH/]

  • Returns an HTML page listing the contents at the given path. However, if there is an index.ipynb at this path, this will instead display that dashboard (see Show Dashboard section).

GET /

  • Equivalent of GET /dashboards

Show Dashboard

GET /dashboards/[PATH/]NAME

  • Returns an HTML page displaying the dashboard.

GET /dashboards-plain/[PATH/]NAME

  • Returns an HTML page displaying only the dashboard content (e.g. no site headers). This is useful for embedding or demonstrating a single dashboard.

Upload Notebook

POST /_api/notebooks/[PATH/]NAME

  • URL Parameters:

    • NAME: the new dashboard's public name
    • PATH: optional path to place the notebook
      • For example, POST /_api/notebooks/foo/bar/baz will name the uploaded notebook baz.ipynb and place it in the foo/bar directory
  • The uploaded dashboard is accessible at /dashboards/[PATH/]NAME.

  • If the server is configured with an authentication token, provide the token in the "Authorization" header:

    Authorization: token 1234567890abcdef
    
  • To send the dashboard data, use a "form data" request with a field named "file" set to either a Jupyter Notebook file (*.ipynb) or a bundled dashboard file (*.zip).

    • A bundled dashboard is a ZIP archive containing an index.ipynb notebook file along with any resources the notebook requires. For example:

        bundle.zip:
            index.ipynb
            stylesheet.css
            image.jpg
            urth_components/
      
  • Response contains the following fields:

    • message: upload result status message
    • status: HTTP response status code
    • url: relative URL used to upload notebook
    • link: public link to access uploaded notebook

    Example:

    {
        "message": "Notebook successfully uploaded",
        "status": 201,
        "url": "/notebooks/p1",
        "link": "http://192.168.99.100:3000/dashboards/p1"
    }
    

Delete Dashboard

DELETE /_api/notebooks/PATH

  • URL Parameters:

    • PATH: path of dashboard to be deleted
      • For example, to delete a dashboard available at http://HOST/dashboards/foo/bar/baz, send a request to DELETE /_api/notebooks/foo/bar/baz
  • If the server is configured with an authentication token, provide the token in the "Authorization" header:

    Authorization: token 1234567890abcdef
    
  • Returns status code 204 on success.

    • Only allows deletion of notebook files or bundled dashboards. A request for any other path will return status code 400.

Clear Cached Dashboards

DELETE /_api/cache[/PATH]

  • Clear the cached version of a dashboard or all dashboards. On the next GET request(s), the dashboard(s) will be read from storage.

  • URL Parameters:

    • PATH: path of dashboard; if not specified, deletes entire cache
  • If the server is configured with an authentication token, provide the token in the "Authorization" header:

    Authorization: token 1234567890abcdef
    
  • Returns status code 200 on success.

Kernel Proxy

GET|POST|PUT|DELETE /api/*

  • Proxies Jupyter Kernel requests to the appropriate kernel gateway.

  • For execute_request messages, only a cell index is allowed in the code field. If actual code or non-numeric are specified, the entire message is not proxied to the kernel gateway.

Login/Logout

POST /login

  • Login to the dashboard server, passing username and password in the request body. Starts a session.

POST /logout

  • Logs out user defined by session.