layout: page title: “Apache Zeppelin Notebook REST API” description: “This page contains Apache Zeppelin Notebook REST API information.” group: usage/rest_api

{% include JB/setup %}

Apache Zeppelin Notebook REST API

Overview

Apache Zeppelin provides several REST APIs for interaction and remote activation of zeppelin functionality. All REST APIs are available starting with the following endpoint http://[zeppelin-server]:[zeppelin-port]/api. Note that Apache Zeppelin REST APIs receive or return JSON objects, it is recommended for you to install some JSON viewers such as JSONView. If you work with Apache Zeppelin and find a need for an additional REST API, please file an issue or send us an email.

Notebooks REST API supports the following operations: List, Create, Get, Delete, Clone, Run, Export, Import as detailed in the following tables.

Note operations

List of the notes

{
  "status": "OK",
  "message": "",
  "body": [
    {
      "path":"Homepage",
      "id":"2AV4WUEMK"
    },
    {
      "path":"Zeppelin Tutorial",
      "id":"2A94M5J1Z"
    }
  ]
}
{"name": "name of new note"}
{
  "name": "name of new note",
  "paragraphs": [
    {
      "title": "paragraph title1",
      "text": "paragraph text1"
    },
    {
      "title": "paragraph title2",
      "text": "paragraph text2",
      "config": {
        "title": true,
        "colWidth": 6.0,
        "results": [
          {
            "graph": {
              "mode": "scatterChart",
              "optionOpen": true
            }
          }
        ]
      }
    }
  ]
}
{
  "status": "OK",
  "message": "",
  "body": "2AZPHY918"
}
{
  "status": "OK",
  "body": [
    {
      "id":"20151121-212654\_766735423",
      "status":"FINISHED",
      "finished":"Tue Nov 24 14:21:40 KST 2015",
      "started":"Tue Nov 24 14:21:39 KST 2015"
    },
    {
      "progress":"1",
      "id":"20151121-212657\_730976687",
      "status":"RUNNING",
      "finished":"Tue Nov 24 14:21:35 KST 2015",
      "started":"Tue Nov 24 14:21:40 KST 2015"
    }
  ]
}
{
  "status": "OK",
  "message": "",
  "body": {
    "paragraphs": [
      {
        "text": "%sql \nselect age, count(1) value\nfrom bank \nwhere age < 30 \ngroup by
 age \norder by age",
        "config": {
          "colWidth": 4,
          "graph": {
            "mode": "multiBarChart",
            "height": 300,
            "optionOpen": false,
            "keys": [
              {
                "name": "age",
                "index": 0,
                "aggr": "sum"
              }
            ],
            "values": [
              {
                "name": "value",
                "index": 1,
                "aggr": "sum"
              }
            ],
            "groups": [],
            "scatter": {
              "xAxis": {
                "name": "age",
                "index": 0,
                "aggr": "sum"
              },
              "yAxis": {
                "name": "value",
                "index": 1,
                "aggr": "sum"
              }
            }
          }
        },
        "settings": {
          "params": {},
          "forms": {}
        },
        "jobName": "paragraph\_1423500782552\_-1439281894",
        "id": "20150210-015302\_1492795503",
        "results": {
          "code": "SUCCESS",
          "msg": [
            {
              "type": "TABLE",
              "data": "age\tvalue\n19\t4\n20\t3\n21\t7\n22\t9\n23\t20\n24\t24\n25\t44\n26
\t77\n27\t94\n28\t103\n29\t97\n"
            }
          ]
        },
        "dateCreated": "Feb 10, 2015 1:53:02 AM",
        "dateStarted": "Jul 3, 2015 1:43:17 PM",
        "dateFinished": "Jul 3, 2015 1:43:23 PM",
        "status": "FINISHED",
        "progressUpdateIntervalMs": 500
      }
    ],
    "name": "Zeppelin Tutorial",
    "id": "2A94M5J1Z",
    "angularObjects": {},
    "config": {
      "looknfeel": "default"
    },
    "info": {}
  }
}
{"status": "OK","message": ""}
{
  "name": "name of new note",
  "revisionId": "revisionId of note to be copied (optional)"
}
{
  "status": "OK",
  "message": "",
  "body": "2AZPHY918"
}
{"name": "new name of a note"}
{"status":"OK"}
{
  "paragraphs": [
    {
      "text": "%md This is my new paragraph in my new note",
      "dateUpdated": "Jan 8, 2016 4:49:38 PM",
      "config": {
        "enabled": true
      },
      "settings": {
        "params": {},
        "forms": {}
      },
      "jobName": "paragraph\_1452300578795\_1196072540",
      "id": "20160108-164938\_1685162144",
      "dateCreated": "Jan 8, 2016 4:49:38 PM",
      "status": "READY",
      "progressUpdateIntervalMs": 500
    }
  ],
  "name": "source note for export",
  "id": "2B82H3RR1",
  "angularObjects": {},
  "config": {},
  "info": {}
}
{
  "paragraphs": [
    {
      "text": "%md This is my new paragraph in my new note",
      "dateUpdated": "Jan 8, 2016 4:49:38 PM",
      "config": {
        "enabled": true
      },
      "settings": {
        "params": {},
        "forms": {}
      },
      "jobName": "paragraph\_1452300578795\_1196072540",
      "id": "20160108-164938\_1685162144",
      "dateCreated": "Jan 8, 2016 4:49:38 PM",
      "status": "READY",
      "progressUpdateIntervalMs": 500
    }
  ],
  "name": "source note for export",
  "id": "2B82H3RR1",
  "angularObjects": {},
  "config": {},
  "info": {}
}
{
  "status": "OK",
  "message": "",
  "body": "2AZPHY918"
}

Run all paragraphs

{"status": "OK"}
{
  "status": "NOT_FOUND",
  "message": "note not found."
}
{
  "status": "PRECONDITION_FAILED",
  "message": "paragraph_1469771130099_-278315611 Not selected or Invalid Interpreter
 bind"
}
{"status":"OK"}
{"status": "OK"}

Paragraph operations

{
  "title": "Paragraph insert revised",
  "text": "%spark\nprintln(\"Paragraph insert revised\")"
}
{
  "title": "Paragraph insert revised",
  "text": "%spark\nprintln(\"Paragraph insert revised\")",
  "index": 0
}
{
  "title": "paragraph title2",
  "text": "paragraph text2",
  "config": {
    "title": true,
    "colWidth": 6.0,
    "results": [
      {
        "graph": {
          "mode": "pieChart",
          "optionOpen": true
        }
      }
    ]
  }
}
{
  "status": "OK",
  "message": "",
  "body": "20151218-100330\_1754029574"
}
{
  "status": "OK",
  "message": "",
  "body": {
    "title": "Paragraph2",
    "text": "%spark\n\nprintln(\"it's paragraph2\")",
    "dateUpdated": "Dec 18, 2015 7:33:54 AM",
    "config": {
      "colWidth": 12,
      "graph": {
        "mode": "table",
        "height": 300,
        "optionOpen": false,
        "keys": [],
        "values": [],
        "groups": [],
        "scatter": {}
      },
      "enabled": true,
      "title": true,
      "editorMode": "ace/mode/scala"
    },
    "settings": {
      "params": {},
      "forms": {}
    },
    "jobName": "paragraph\_1450391574392\_-1890856722",
    "id": "20151218-073254\_1105602047",
    "results": {
      "code": "SUCCESS",
      "msg": [
        {
           "type": "TEXT",
           "data": "it's paragraph2\n"
        }
      ]
    },
    "dateCreated": "Dec 18, 2015 7:32:54 AM",
    "dateStarted": "Dec 18, 2015 7:33:55 AM",
    "dateFinished": "Dec 18, 2015 7:33:55 AM",
    "status": "FINISHED",
    "progressUpdateIntervalMs": 500
  }
}
{
  "status": "OK",
  "body": {
      "id":"20151121-212654\_766735423",
      "status":"FINISHED",
      "finished":"Tue Nov 24 14:21:40 KST 2015",
      "started":"Tue Nov 24 14:21:39 KST 2015"
    }
}

Update paragraph

{
  "title": "Hello world",
  "text": "println(\"hello world\")"
}
{
  "status": "OK",
  "message": ""
}
{
  "colWidth": 6.0,
  "graph": {
    "mode": "lineChart",
    "height": 200.0,
    "optionOpen": false,
    "keys": [
      {
        "name": "age",
        "index": 0.0,
        "aggr": "sum"
      }
    ],
    "values": [
      {
        "name": "value",
        "index": 1.0,
        "aggr": "sum"
      }
    ],
    "groups": [],
    "scatter": {}
  },
  "editorHide": true,
  "editorMode": "ace/mode/markdown",
  "tableHide": false
}
{
  "status":"OK",
  "message":"",
  "body":{
    "text":"%sql \nselect age, count(1) value\nfrom bank \nwhere age \u003c 30 \ngroup by
 age \norder by age",
    "config":{
      "colWidth":6.0,
      "graph":{
        "mode":"lineChart",
        "height":200.0,
        "optionOpen":false,
        "keys":[
          {
            "name":"age",
            "index":0.0,
            "aggr":"sum"
          }
        ],
        "values":[
          {
            "name":"value",
            "index":1.0,
            "aggr":"sum"
          }
        ],
        "groups":[],
        "scatter":{}
      },
      "tableHide":false,
      "editorMode":"ace/mode/markdown",
      "editorHide":true
    },
    "settings":{
      "params":{},
      "forms":{}
    },
    "apps":[],
    "jobName":"paragraph_1423500782552_-1439281894",
    "id":"20150210-015302_1492795503",
    "results":{
      "code":"SUCCESS",
      "msg": [
        {
          "type":"TABLE",
          "data":"age\tvalue\n19\t4\n20\t3\n21\t7\n22\t9\n23\t20\n24\t24\n25\t44\n26\t77
\n27\t94\n28\t103\n29\t97\n"
        }
      ]
    },
    "dateCreated":"Feb 10, 2015 1:53:02 AM",
    "dateStarted":"Jul 3, 2015 1:43:17 PM",
    "dateFinished":"Jul 3, 2015 1:43:23 PM",
    "status":"FINISHED",
    "progressUpdateIntervalMs":500
  }
}
{"status": "OK","message": ""}
{
  "name": "name of new note",
  "params": {
    "formLabel1": "value1",
    "formLabel2": "value2"
  }
}
{"status": "OK"}
{
  "name": "name of new note",
  "params": {
    "formLabel1": "value1",
    "formLabel2": "value2"
  }
}
{"status": "OK"}
{
   "status": "INTERNAL\_SERVER\_ERROR",
   "body": {
       "code": "ERROR",
       "type": "TEXT",
       "msg": "bash: -c: line 0: unexpected EOF while looking for matching ``'\nbash: -c:
 line 1: syntax error: unexpected end of file\nExitValue: 2"
   }
}
{"status": "OK"}
{"status": "OK","message": ""}
{
  "status": "OK",
  "body": [
    {
      "id": "<noteId>/paragraph/<paragraphId>",
      "name":"Note Name", 
      "snippet":"",
      "text":""
    }
  ]
}

Cron jobs

{"cron": "cron expression of note", "releaseResource": "false"}
{"status": "OK"}

Remove Cron Job

{"status": "OK"}

Get Cron Job

{
   "status": "OK", 
   "body": {
      "cron": "0 0/1 * * * ?", 
      "releaseResource": true
   }
}

Permission

Get a note permission information

{  
   "status":"OK",
   "message":"",
   "body":{  
      "readers":[  
         "user2"
      ],
      "owners":[  
         "user1"
      ],
      "runners":[
         "user2"
      ],
      "writers":[  
         "user2"
      ]
   }
}
{
  "readers": [
    "user1"
  ],
  "owners": [
    "user2"
  ],
  "runners":[
    "user2"
  ],
  "writers": [
    "user1"
  ]
}
{
  "status": "OK"
}

Version control

Get revisions of a note

{
    "status": "OK",
    "body": [
        {
            "id": "f97ce5c7f076783023d33623ad52ca994277e5c1",
            "message": "first commit",
            "time": 1645712061
        },
        {
            "id": "e9b964bebdecec6a59efe085f97db4040ae333aa",
            "message": "second commit",
            "time": 1645693163
        }
    ]
}
{
  "commitMessage": "first commit"
}
{
  "status": "OK",
  "message": "",
  "body": "6a5879218dfb797b013bcd24a594808045e34875"
}
{
  "status": "OK",
  "message": "",
  "body": {
    "paragraphs": [
      {
        "text": "%sql \nselect age, count(1) value\nfrom bank \nwhere age < 30 \ngroup by
 age \norder by age",
        "config": {
          "colWidth": 4,
          "graph": {
            "mode": "multiBarChart",
            "height": 300,
            "optionOpen": false,
            "keys": [
              {
                "name": "age",
                "index": 0,
                "aggr": "sum"
              }
            ],
            "values": [
              {
                "name": "value",
                "index": 1,
                "aggr": "sum"
              }
            ],
            "groups": [],
            "scatter": {
              "xAxis": {
                "name": "age",
                "index": 0,
                "aggr": "sum"
              },
              "yAxis": {
                "name": "value",
                "index": 1,
                "aggr": "sum"
              }
            }
          }
        },
        "settings": {
          "params": {},
          "forms": {}
        },
        "jobName": "paragraph\_1423500782552\_-1439281894",
        "id": "20150210-015302\_1492795503",
        "results": {
          "code": "SUCCESS",
          "msg": [
            {
              "type": "TABLE",
              "data": "age\tvalue\n19\t4\n20\t3\n21\t7\n22\t9\n23\t20\n24\t24\n25\t44\n26
\t77\n27\t94\n28\t103\n29\t97\n"
            }
          ]
        },
        "dateCreated": "Feb 10, 2015 1:53:02 AM",
        "dateStarted": "Jul 3, 2015 1:43:17 PM",
        "dateFinished": "Jul 3, 2015 1:43:23 PM",
        "status": "FINISHED",
        "progressUpdateIntervalMs": 500
      }
    ],
    "name": "Zeppelin Tutorial",
    "id": "2A94M5J1Z",
    "angularObjects": {},
    "config": {
      "looknfeel": "default"
    },
    "info": {}
  }
}
{
  "status": "OK"
}