zeppelin/docs/rest-api/rest-notebook.md
2015-12-16 15:48:03 +09:00

11 KiB

layout title description group
page Notebook REST API rest-api

{% include JB/setup %}

Zeppelin REST API

Zeppelin provides several REST API's for interaction and remote activation of zeppelin functionality.

All REST API are available starting with the following endpoint http://[zeppelin-server]:[zeppelin-port]/api

Note that zeppelin REST API receive or return JSON objects, it it recommended you install some JSON view such as JSONView

If you work with zeppelin and find a need for an additional REST API please file an issue or send us mail


### Notebook REST API list

Notebooks REST API supports the following operations: List, Create, Delete & Clone as detailed in the following table

List notebooks
Description This ```GET``` method list the available notebooks on your server. Notebook JSON contains the ```name``` and ```id``` of all notebooks.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook```
Success code 200
Fail code 500
sample JSON response
{"status":"OK","message":"","body":[{"name":"Homepage","id":"2AV4WUEMK"},{"name":"Zeppelin Tutorial","id":"2A94M5J1Z"}]}

Create notebook
Description This ```POST``` method create a new notebook using the given name or default name if none given. The body field of the returned JSON contain the new notebook id.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook```
Success code 201
Fail code 500
sample JSON input
{"name": "name of new notebook"}
sample JSON response
{"status": "CREATED","message": "","body": "2AZPHY918"}

Delete notebook
Description This ```DELETE``` method delete a notebook by the given notebook id.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]```
Success code 200
Fail code 500
sample JSON response
{"status":"OK","message":""}

Clone notebook
Description This ```POST``` method clone a notebook by the given id and create a new notebook using the given name or default name if none given. The body field of the returned JSON contain the new notebook id.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]```
Success code 201
Fail code 500
sample JSON input
{"name": "name of new notebook"}
sample JSON response
{"status": "CREATED","message": "","body": "2AZPHY918"}

Run notebook job
Description This ```POST``` method run all paragraph in the given notebook id.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]```
Success code 200
Fail code 500
sample JSON response
{"status":"OK"}

Stop notebook job
Description This ```DELETE``` method stop all paragraph in the given notebook id.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]```
Success code 200
Fail code 500
sample JSON response
{"status":"OK"}


Get notebook job
Description This ```GET``` method get all paragraph status by the given notebook id. The body field of the returned JSON contains of the array that compose of the paragraph id, paragraph status, paragraph finish date, paragraph started date.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]```
Success code 200
Fail code 500
sample JSON response
{"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"},{"id":"20151121-212657_730976687","status":"FINISHED","finished":"Tue Nov 24 14:21:40 KST 2015","started":"Tue Nov 24 14:21:40 KST 2015"}]}

Run paragraph job
Description This ```POST``` method run the paragraph by given notebook and paragraph id.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]/[paragraphId]```
Success code 200
Fail code 500
sample JSON response
{"status":"OK"}

Stop paragraph job
Description This ```DELETE``` method stop the paragraph by given notebook and paragraph id.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]/[paragraphId]```
Success code 200
Fail code 500
sample JSON response
{"status":"OK"}

Add cron job
Description This ```POST``` method add cron job by the given notebook id.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[notebookId]```
Success code 200
Fail code 500
sample JSON input
{"cron": "cron expression of notebook"}
sample JSON response
{"status":"OK"}

Remove cron job
Description This ```DELETE``` method remove cron job by the given notebook id.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[notebookId]```
Success code 200
Fail code 500
sample JSON response
{"status":"OK"}

Get clone job
Description This ```GET``` method get cron job expression of given notebook id. The body field of the returned JSON contain the cron expression.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[notebookId]```
Success code 200
Fail code 500
sample JSON response
{"status":"OK","body":"* * * * * ?"}
Full-text search through the paragraphs in all notebooks
Description ```GET``` request will return list of matching paragraphs
URL ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/search?q=[query]```
Success code 200
Fail code 500
Sample JSON response
{"status":"OK", body: [{"id":"/paragraph/", "name":"Notebook Name", "snippet":"", "text":""}]}