Skip to main content
Version: 0.6.0

Notebook REST API

Create a Notebook Instance

POST /api/v1/notebook

Parameters

NotebookSpec in request body.

NotebookSpec

Field NameTypeDescription
metaNotebookMetaMeta data of the notebook.
environmentEnvironmentSpecEnvironment of the experiment template.
specNotebookPodSpecSpec of the notebook pods.

NotebookMeta

Field NameTypeDescription
nameStringNotebook name.
namespaceStringNotebook namespace.
ownerIdStringUser id.

EnvironmentSpec

See more details in environment api.

NotebookPodSpec

Field NameTypeDescription
envVarsMap<String, String>Environmental variables.
resourcesStringResourecs of the pod.

Code Example

shell

curl -X POST -H "Content-Type: application/json" -d '
{
"meta": {
"name": "test-nb",
"namespace": "default",
"ownerId": "e9ca23d68d884d4ebb19d07889727dae"
},
"environment": {
"name": "notebook-env"
},
"spec": {
"envVars": {
"TEST_ENV": "test"
},
"resources": "cpu=1,memory=1.0Gi"
}
}
' http://127.0.0.1:32080/api/v1/notebook

response:

{
"status":"OK",
"code":200,
"success":true,
"message":"Create a notebook instance",
"result":{
"notebookId":"notebook_1626160071451_0001",
"name":"test-nb",
"uid":"a56713da-f2a3-40d0-ae2e-45fdc0bb15f5",
"url":"/notebook/default/test-nb/lab",
"status":"creating",
"reason":"The notebook instance is creating",
"createdTime":"2021-07-13T16:23:38.000+08:00",
"deletedTime":null,
"spec":{
"meta":{
"name":"test-nb",
"namespace":"default",
"ownerId":"e9ca23d68d884d4ebb19d07889727dae"
},
"environment":{
"name":"notebook-env",
"dockerImage":"apache/submarine:jupyter-notebook-0.6.0",
"kernelSpec":{
"name":"submarine_jupyter_py3",
"channels":["defaults"],
"condaDependencies":[],
"pipDependencies":[]
},
"description":null,
"image":null
},
"spec":{
"envVars":{"TEST_ENV":"test"},
"resources":"cpu\u003d1,memory\u003d1.0Gi"
}
}
},
"attributes":{}
}

List notebook instances which belong to user

GET /api/v1/notebook

Parameters

Field NameTypeInDescription
idStringqueryUser id.

Code Example

shell

curl -X GET http://127.0.0.1:32080/api/v1/notebook?id=e9ca23d68d884d4ebb19d07889727dae

response

{
"status":"OK",
"code":200,
"success":true,
"message":"List all notebook instances",
"result":
[{
"notebookId":"notebook_1626160071451_0001",
"name":"test-nb",
"uid":"a56713da-f2a3-40d0-ae2e-45fdc0bb15f5",
"url":"/notebook/default/test-nb/lab",
"status":"waiting",
"reason":"ContainerCreating",
"createdTime":"2021-07-13T16:23:38.000+08:00",
"deletedTime":null,
"spec":{
"meta":{
"name":"test-nb",
"namespace":"default",
"ownerId":"e9ca23d68d884d4ebb19d07889727dae"
},
"environment":{
"name":"notebook-env",
"dockerImage":"apache/submarine:jupyter-notebook-0.6.0",
"kernelSpec":{
"name":"submarine_jupyter_py3",
"channels":["defaults"],
"condaDependencies":[],
"pipDependencies":[]
},
"description":null,
"image":null
},
"spec":{
"envVars":{"TEST_ENV":"test"},
"resources":"cpu\u003d1,memory\u003d1.0Gi"
}
}
}],
"attributes":{}
}

Get the notebook instance

GET /api/v1/notebook/{id}

Parameters

Field NameTypeInDescription
idStringpathNotebook id.

Code Example

shell

curl -X GET http://127.0.0.1:32080/api/v1/notebook/notebook_1626160071451_0001

response

{
"status":"OK",
"code":200,
"success":true,
"message":"Get the notebook instance",
"result":{
"notebookId":"notebook_1626160071451_0001",
"name":"test-nb",
"uid":"a56713da-f2a3-40d0-ae2e-45fdc0bb15f5",
"url":"/notebook/default/test-nb/lab",
"status":"waiting",
"reason":"ContainerCreating",
"createdTime":"2021-07-13T16:23:38.000+08:00",
"deletedTime":null,
"spec":{
"meta":{
"name":"test-nb",
"namespace":"default",
"ownerId":"e9ca23d68d884d4ebb19d07889727dae"
},
"environment":{
"name":"notebook-env",
"dockerImage":"apache/submarine:jupyter-notebook-0.6.0",
"kernelSpec":{
"name":"submarine_jupyter_py3",
"channels":["defaults"],
"condaDependencies":[],
"pipDependencies":[]
},
"description":null,
"image":null
},
"spec":{
"envVars":{"TEST_ENV":"test"},
"resources":"cpu\u003d1,memory\u003d1.0Gi"
}
}
},
"attributes":{}
}

Delete the notebook instance

DELETE /api/v1/notebook/{id}

Parameters

Field NameTypeInDescription
idStringpathNotebook id.

Code Example

shell

curl -X DELETE http://127.0.0.1:32080/api/v1/notebook/notebook_1626160071451_0001

response:

{
"status":"OK",
"code":200,
"success":true,
"message":"Delete the notebook instance",
"result":{
"notebookId":"notebook_1626160071451_0001",
"name":"test-nb",
"uid":"a56713da-f2a3-40d0-ae2e-45fdc0bb15f5",
"url":"/notebook/default/test-nb/lab",
"status":"terminating",
"reason":"The notebook instance is terminating",
"createdTime":"2021-07-13T16:23:38.000+08:00",
"deletedTime":null,
"spec":{
"meta":{
"name":"test-nb",
"namespace":"default",
"ownerId":"e9ca23d68d884d4ebb19d07889727dae"
},
"environment":{
"name":"notebook-env",
"dockerImage":"apache/submarine:jupyter-notebook-0.6.0",
"kernelSpec":{
"name":"submarine_jupyter_py3",
"channels":["defaults"],
"condaDependencies":[],
"pipDependencies":[]
},
"description":null,
"image":null
},
"spec":{
"envVars":{"TEST_ENV":"test"},
"resources":"cpu\u003d1,memory\u003d1.0Gi"
}
}
},
"attributes":{}
}