Create a Jupyter Notebook or Directory

POST /api/v1.2/jupyter_notebooks/contents/<Path>

Use this API to create a Jupyter notebook or a directory. To know how to create a notebook using the JupyterLab interface, see Creating Jupyter Notebooks.

Note

This API is not available by default. Create a ticket with Qubole Support to enable this API on your QDS account.

Required Role

The following users can make this API call:

  • Users who belong to the system-user or system-admin group.
  • Users who belong to a group associated with a role that allows update on Jupyter Notebook and directory. See Managing Groups and Managing Roles for more information.

Path Parameters

Parameter Description
Path Location of the Jupyter notebook or directory. The accepted folder locations are: Users/current_user_email_id, Common, and Users. You must have privileges to create/edit Jupyter notebooks in Common and Users. For more information, see Managing Folder-level Permissions.

Parameters

The following parameters are mandatory.

Parameter Description
name Name of the Jupyter notebook or directory. It is a string that can accept alpha-numerical characters and the following special characters: +, -, _, @, and |. Name of the notebook should not include extension.
type Type of the object to be created. The values are notebook and directory.
kernel JSON containing name of the Kernel. Possible values: pysparkkernel, sparkkernel, sparkrkernel, and python.

Request API Syntax

curl -i -X POST -H "X-AUTH-TOKEN: <token> " -H "Content-Type: application/json" -H "Accept: application/json"\
 -d '{"name": "<Name>", "type": "<Type>", "kernel": {"name":"<KernelName>"}}' \
 "https://api.qubole.com/api/v1.2/jupyter_notebooks/contents/<Path>"

Note

The above syntax uses https://api.qubole.com as the endpoint. Qubole provides other endpoints to access QDS that are described in Supported Qubole Endpoints on Different Cloud Providers.

Sample API Request

The following example shows how to create a Jupyter notebook:

curl -i -X POST -H "X-AUTH-TOKEN: $AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"name": "note1", "type": "notebook", "kernel": {"name":"pysparkkernel"}}' \
"https://api.qubole.com/api/v1.2/jupyter_notebooks/contents/Users/[email protected]"

The following example shows how to create a directory:

curl -i -X POST -H "X-AUTH-TOKEN: $AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"name": "folder1", "type": "directory"}'\
 "https://api.qubole.com/api/v1.2/jupyter_notebooks/contents/Users/[email protected]"