Attention
This is copied verbatim from the old IPython wiki and is currently under development. Much of the information in this part of the development guide is out of date.
The tables below show the current RESTful web service architecture implemented in IPython notebook. The listed URL’s use the HTTP verbs to return representations of the desired resource.
We are in the process of creating a new dashboard architecture for the IPython notebook, which will allow the user to navigate through multiple directory files to find desired notebooks.
Miscellaneous
HTTP verb
URL
Action
GET
/.*/
Strips trailing slashes.
/api
Returns api version information.
*
/api/notebooks
Deprecated: redirect to /api/contents
/api/nbconvert
Notebook contents API.
/api/contents
Return a model for the base directory. See /api/contents/<path>/<file>.
/api/contents/ <file>
Return a model for the given file in the base directory. See /api/contents/<path>/<file>.
/api/contents/ <path>/<file>
Return a model for a file or directory. A directory model contains a list of models (without content) of the files and directories it contains.
PUT
Saves the file in the location specified by name and path. PUT is very similar to POST, but the requester specifies the name, where as with POST, the server picks the name. PUT /api/contents/path/Name.ipynb Save notebook at path/Name.ipynb. Notebook structure is specified in content key of JSON request body. If content is not specified, create a new empty notebook. PUT /api/contents/path/Name.ipynb with JSON body {“copy_from” : “[path/to/] OtherNotebook.ipynb”} Copy OtherNotebook to Name
path/Name.ipynb
content
PATCH
Renames a notebook without re-uploading content.
POST
Creates a new file or directory in the specified path. POST creates new files or directories. The server always decides on the name. POST /api/contents/path New untitled notebook in path. If content specified, upload a notebook, otherwise start empty. POST /api/contents/path with body {“copy_from”:”OtherNotebook.ipynb”} New copy of OtherNotebook in path
DELETE
delete a file in the given path.
/api/contents/ <path>/<file> /checkpoints
get lists checkpoint for a file.
post creates a new checkpoint.
/api/contents/ <path>/<file> /checkpoints/ <checkpoint_ id>
post restores a file from a checkpoint.
delete clears a checkpoint for a given file.
Kernel API
URI
/api/kernels
Return a model of all kernels.
/api/kernels /<kernel_id>
Return a model of kernel with given kernel id.
Start a new kernel with default or given name.
Shutdown the given kernel.
/api/kernels /<kernel_id> /<action>
Perform action on kernel with given kernel id. Actions can be “interrupt” or “restart”.
WS
/api/kernels /<kernel_id> /channels
Websocket stream
/api/kernel specs
Return a spec model of all available kernels.
/api/kernel specs/ <kernel_name>
Return a spec model of all available kernels with a given kernel name.
Sessions API
/api/sesions
Return model of active sessions.
/api/sessions
If session does not already exist, create a new session with given notebook name and path and given kernel name. Return active sesssion.
/api/sessions /<session_id>
Return model of active session with given session id.
Return model of active session with notebook name or path of session with given session id.
Delete model of active session with given session id.
Clusters API
/api/clusters
Return model of clusters.
/api/clusters <cluster_id>
Return model of given cluster.
/api/clusters <cluster_id> <action>
Perform action with given clusters. Valid actions are “start” and “stop”
This chart shows the web-services in the single directory IPython notebook.
/notebooks
return list of dicts with each notebook’s info
if sending a body, saving that body as a new notebook; if no body, create a a new notebook.
/notebooks /<notebook_id>
get JSON data for notebook
saves an existing notebook with body data
deletes the notebook with the given ID
This chart shows the architecture for the IPython notebook website.
/
navigates user to dashboard of notebooks and clusters.
/<notebook_id>
go to wepage for that notebook
/new
creates a new notebook with profile (or default, if no profile exists) setings
/<notebook_id> /copy
opens a duplicate copy or the notebook with the given ID in a new tab
/<notebook_id> /print
prints the notebook with the given ID; if notebook doesn’t exist, displays error message
/login
navigates to login page; if no user profile is defined, it navigates user to dashboard
/logout
logs out of current profile, and navigates user to login page
This chart shows the Web services that act on the kernels and clusters.
/kernels
return the list of kernel IDs currently running
/kernels /<kernel_id>
—
/kernels /<kernel_id> <action>
performs action (restart/kill) kernel with given ID
/kernels /<kernel_id> /iopub
/kernels /<kernel_id> /shell
/rstservice/ render
/files/(.*)
/clusters
returns a list of dicts with each cluster’s information
/clusters /<profile_id> /<cluster_ action>
performs action (start/stop) on cluster with given profile ID
/clusters /<profile_id>
returns the JSON data for cluster with given profile ID