Notebook - Create Or Update Notebook

Creates or updates a Note Book.

PUT {endpoint}/notebooks/{notebookName}?api-version=2020-12-01

URI Parameters

Name In Required Type Description
endpoint
path True

string

uri

The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net.

notebookName
path True

string

The notebook name.

api-version
query True

string

The Synapse client API Version.

Request Header

Name Required Type Description
If-Match

string

ETag of the Note book entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update.

Request Body

Name Required Type Description
name True

string

The name of the resource

properties True

Notebook

Properties of Notebook.

Responses

Name Type Description
200 OK

NotebookResource

OK.

202 Accepted

Accepted.

Other Status Codes

CloudError

An error response received from the Azure Synapse service.

Examples

Notebooks_Create
Notebooks_Update

Notebooks_Create

Sample Request

PUT exampleWorkspace.dev.azuresynapse.net/notebooks/exampleNotebook?api-version=2020-12-01

{
  "name": "exampleNotebook",
  "properties": {
    "description": "A sample Notebook",
    "nbformat": 4,
    "nbformat_minor": 2,
    "bigDataPool": {
      "referenceName": "exampleBigDataPoolName",
      "type": "BigDataPoolReference"
    },
    "sessionProperties": {
      "driverMemory": "28g",
      "driverCores": 4,
      "executorMemory": "28g",
      "executorCores": 4,
      "numExecutors": 1
    },
    "metadata": {
      "language_info": {
        "name": "python"
      },
      "kernelspec": {
        "name": "exampleName",
        "display_name": "exampleDisplayName"
      }
    },
    "cells": [
      {
        "cell_type": "code",
        "metadata": {},
        "source": [
          "def my_function():\n",
          " print(\"Hello from a function\")\n",
          "\n",
          "my_function()"
        ],
        "attachments": {},
        "outputs": [
          {
            "execution_count": 3,
            "output_type": "execute_result",
            "data": {
              "text/plain": "Hello from a function"
            },
            "metadata": {}
          }
        ]
      }
    ]
  }
}

Sample Response

Date: Sat, 16 Jun 2018 00:37:41 GMT
X-Content-Type-Options: nosniff
x-ms-ratelimit-remaining-subscription-writes: 1192
x-ms-request-id: e4c589b7-a9fe-4c28-981c-3855ec27d264
x-ms-correlation-request-id: e4c589b7-a9fe-4c28-981c-3855ec27d264
{
  "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Synapse/workspaces/exampleWorkspaceName/Notebooks/exampleNotebook",
  "name": "exampleNotebook",
  "type": "Microsoft.Synapse/workspaces/Notebooks",
  "properties": {
    "description": "A sample Notebook",
    "nbformat": 4,
    "nbformat_minor": 2,
    "bigDataPool": {
      "referenceName": "exampleBigDataPoolName",
      "type": "BigDataPoolReference"
    },
    "sessionProperties": {
      "driverMemory": "28g",
      "driverCores": 4,
      "executorMemory": "28g",
      "executorCores": 4,
      "numExecutors": 1
    },
    "metadata": {
      "language_info": {
        "name": "python"
      },
      "kernelspec": {
        "name": "exampleName",
        "display_name": "exampleDisplayName"
      }
    },
    "cells": [
      {
        "cell_type": "code",
        "metadata": {},
        "source": [
          "def my_function():\n",
          " print(\"Hello from a function\")\n",
          "\n",
          "my_function()"
        ],
        "attachments": {},
        "outputs": [
          {
            "execution_count": 3,
            "output_type": "execute_result",
            "data": {
              "text/plain": "Hello from a function"
            },
            "metadata": {}
          }
        ]
      }
    ]
  },
  "etag": "0a0069d4-0000-0000-0000-5b245bd50000"
}

Notebooks_Update

Sample Request

PUT exampleWorkspace.dev.azuresynapse.net/notebooks/exampleNotebook?api-version=2020-12-01

{
  "name": "exampleNotebook",
  "properties": {
    "description": "Modified description",
    "nbformat": 4,
    "nbformat_minor": 2,
    "bigDataPool": {
      "referenceName": "exampleBigDataPoolName",
      "type": "BigDataPoolReference"
    },
    "sessionProperties": {
      "driverMemory": "28g",
      "driverCores": 4,
      "executorMemory": "28g",
      "executorCores": 4,
      "numExecutors": 1
    },
    "metadata": {
      "language_info": {
        "name": "python"
      },
      "kernelspec": {
        "name": "exampleName",
        "display_name": "exampleDisplayName"
      }
    },
    "cells": [
      {
        "cell_type": "code",
        "metadata": {},
        "source": [
          "def my_function():\n",
          " print(\"Hello from a function\")\n",
          "\n",
          "my_function()"
        ],
        "attachments": {},
        "outputs": [
          {
            "execution_count": 3,
            "output_type": "execute_result",
            "data": {
              "text/plain": "Hello from a function"
            },
            "metadata": {}
          }
        ]
      }
    ]
  }
}

Sample Response

Date: Sat, 16 Jun 2018 00:37:41 GMT
X-Content-Type-Options: nosniff
x-ms-ratelimit-remaining-subscription-writes: 1192
x-ms-request-id: e4c589b7-a9fe-4c28-981c-3855ec27d264
x-ms-correlation-request-id: e4c589b7-a9fe-4c28-981c-3855ec27d264
{
  "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Synapse/workspaces/exampleWorkspaceName/notebooks/exampleNotebook",
  "name": "exampleNotebook",
  "type": "Microsoft.Synapse/workspaces/Notebooks",
  "properties": {
    "description": "Modified description",
    "nbformat": 4,
    "nbformat_minor": 2,
    "bigDataPool": {
      "referenceName": "exampleBigDataPoolName",
      "type": "BigDataPoolReference"
    },
    "sessionProperties": {
      "driverMemory": "28g",
      "driverCores": 4,
      "executorMemory": "28g",
      "executorCores": 4,
      "numExecutors": 1
    },
    "metadata": {
      "language_info": {
        "name": "python"
      },
      "kernelspec": {
        "name": "exampleName",
        "display_name": "exampleDisplayName"
      }
    },
    "cells": [
      {
        "cell_type": "code",
        "metadata": {},
        "source": [
          "def my_function():\n",
          " print(\"Hello from a function\")\n",
          "\n",
          "my_function()"
        ],
        "attachments": {},
        "outputs": [
          {
            "execution_count": 3,
            "output_type": "execute_result",
            "data": {
              "text/plain": "Hello from a function"
            },
            "metadata": {}
          }
        ]
      }
    ]
  },
  "etag": "0a006cd4-0000-0000-0000-5b245bd60000"
}

Definitions

Name Description
BigDataPoolReference

Big data pool reference.

BigDataPoolReferenceType

Big data pool reference type.

CellOutputType

Execution, display, or stream outputs.

CloudError

The object that defines the structure of an Azure Synapse error response.

Folder

The folder that this notebook is in. If not specified, this notebook will appear at the root level.

Notebook

Notebook.

NotebookCell

Notebook cell.

NotebookCellOutputItem

An item of the notebook cell execution output.

NotebookKernelSpec

Kernel information.

NotebookLanguageInfo

Language info.

NotebookMetadata

Notebook root-level metadata.

NotebookResource

Notebook resource type.

NotebookSessionProperties

Session properties.

SparkConfigurationReference

Spark configuration reference.

SparkConfigurationReferenceType

Spark configuration reference type.

BigDataPoolReference

Big data pool reference.

Name Type Description
referenceName

string

Reference big data pool name.

type

BigDataPoolReferenceType

Big data pool reference type.

BigDataPoolReferenceType

Big data pool reference type.

Name Type Description
BigDataPoolReference

string

CellOutputType

Execution, display, or stream outputs.

Name Type Description
display_data

string

error

string

execute_result

string

stream

string

CloudError

The object that defines the structure of an Azure Synapse error response.

Name Type Description
error.code

string

Error code.

error.details

CloudError[]

Array with additional error details.

error.message

string

Error message.

error.target

string

Property name/path in request associated with error.

Folder

The folder that this notebook is in. If not specified, this notebook will appear at the root level.

Name Type Description
name

string

The name of the folder that this notebook is in.

Notebook

Notebook.

Name Type Description
bigDataPool

BigDataPoolReference

Big data pool reference.

cells

NotebookCell[]

Array of cells of the current notebook.

description

string

The description of the notebook.

folder

Folder

The folder that this notebook is in. If not specified, this notebook will appear at the root level.

metadata

NotebookMetadata

Notebook root-level metadata.

nbformat

integer

Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.

nbformat_minor

integer

Notebook format (minor number). Incremented for backward compatible changes to the notebook format.

sessionProperties

NotebookSessionProperties

Session properties.

targetSparkConfiguration

SparkConfigurationReference

The spark configuration of the spark job.

NotebookCell

Notebook cell.

Name Type Description
attachments

object

Attachments associated with the cell.

cell_type

string

String identifying the type of cell.

metadata

object

Cell-level metadata.

outputs

NotebookCellOutputItem[]

Cell-level output items.

source

string[]

Contents of the cell, represented as an array of lines.

NotebookCellOutputItem

An item of the notebook cell execution output.

Name Type Description
data

object

Output data. Use MIME type as key, and content as value.

execution_count

integer

Execution sequence number.

metadata

object

Metadata for the output item.

name

string

For output_type=stream, determines the name of stream (stdout / stderr).

output_type

CellOutputType

Execution, display, or stream outputs.

text

For output_type=stream, the stream's text output, represented as a string or an array of strings.

NotebookKernelSpec

Kernel information.

Name Type Description
display_name

string

Name to display in UI.

name

string

Name of the kernel specification.

NotebookLanguageInfo

Language info.

Name Type Description
codemirror_mode

string

The codemirror mode to use for code in this language.

name

string

The programming language which this kernel runs.

NotebookMetadata

Notebook root-level metadata.

Name Type Description
kernelspec

NotebookKernelSpec

Kernel information.

language_info

NotebookLanguageInfo

Language info.

NotebookResource

Notebook resource type.

Name Type Description
etag

string

Resource Etag.

id

string

Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

The name of the resource

properties

Notebook

Properties of Notebook.

type

string

The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.

NotebookSessionProperties

Session properties.

Name Type Description
driverCores

integer

Number of cores to use for the driver.

driverMemory

string

Amount of memory to use for the driver process.

executorCores

integer

Number of cores to use for each executor.

executorMemory

string

Amount of memory to use per executor process.

numExecutors

integer

Number of executors to launch for this session.

SparkConfigurationReference

Spark configuration reference.

Name Type Description
referenceName

string

Reference spark configuration name.

type

SparkConfigurationReferenceType

Spark configuration reference type.

SparkConfigurationReferenceType

Spark configuration reference type.

Name Type Description
SparkConfigurationReference

string