zeppelin/docs/usage/rest_api/helium.md
Nelson Costa e1f20ddda2 [ZEPPELIN-2699] Helium REST API bug-fixes. Also updated documentation
### What is this PR for?
Fixing bug on enabling Helium plugins (artifact is empty, not null) when sending curl command.
After noticing out-of-date documentation, I updated it
Also noticed issues on missing try/catch expressions and missing info messages on enable/disable packages.

### What type of PR is it?
[Bug Fix | Documentation | Refactoring]

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-2699

### How should this be tested?
Run "curl -X POST http://localhost:8080/api/helium/enable/{packageName}"
Check that the package gets enabled

### Questions:
* Does the licenses files need update? N
* Is there breaking changes for older versions? N
* Does this needs documentation? Y (Done)

Author: Nelson Costa <nelson.costa85@gmail.com>

Closes #2446 from necosta/zeppelin2699 and squashes the following commits:

473f9b43 [Nelson Costa] [ZEPPELIN-2699] Fixed initialization issue
45b77513 [Nelson Costa] [ZEPPELIN-2699] More corrections
c8230218 [Nelson Costa] [ZEPPELIN-2699] Bug-fix on gathering package info
2b1ff8ae [Nelson Costa] [ZEPPELIN-2699] Changes after code review
a71b9fb9 [Nelson Costa] [ZEPPELIN-2699] Changes after code-review
5d179218 [Nelson Costa] [ZEPPELIN-2699] Helium REST API bug-fixes. Also updated documentation
2017-07-22 00:24:20 +09:00

13 KiB

layout title description group
page Apache Zeppelin Helium REST API This page contains Apache Zeppelin Helium REST API information. usage/rest_api

{% include JB/setup %}

Apache Zeppelin Helium 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.

Helium REST API List

Get all available helium packages

Description This ```GET``` method returns all the available helium packages in configured registries.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/package```
Success code 200
Fail code 500
Sample JSON response
{
  "status": "OK",
  "message": "",
  "body": {
    "zeppelin.clock": [
      {
        "registry": "local",
        "pkg": {
          "type": "APPLICATION",
          "name": "zeppelin.clock",
          "description": "Clock (example)",
          "artifact": "zeppelin-examples\/zeppelin-example-clock\/target\/zeppelin-example-clock-0.7.0-SNAPSHOT.jar",
          "className": "org.apache.zeppelin.example.app.clock.Clock",
          "resources": [
            [
              ":java.util.Date"
            ]
          ],
          "icon": "icon"
        },
        "enabled": false
      }
    ]
  }
}
        

Get all enabled helium packages

Description This ```GET``` method returns all enabled helium packages in configured registries.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/enabledPackage```
Success code 200
Fail code 500
Sample JSON response
{
  "status": "OK",
  "message": "",
  "body": {
    "zeppelin.clock": [
      {
        "registry": "local",
        "pkg": {
          "type": "APPLICATION",
          "name": "zeppelin.clock",
          "description": "Clock (example)",
          "artifact": "zeppelin-examples\/zeppelin-example-clock\/target\/zeppelin-example-clock-0.7.0-SNAPSHOT.jar",
          "className": "org.apache.zeppelin.example.app.clock.Clock",
          "resources": [
            [
              ":java.util.Date"
            ]
          ],
          "icon": "icon"
        },
        "enabled": false
      }
    ]
  }
}
        

Get single helium package

Description This ```GET``` method returns specified helium package information
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/package/[Package Name]```
Success code 200
Fail code 500
Sample JSON response
{
  "status": "OK",
  "message": "",
  "body": {
    "zeppelin.clock": [
      {
        "registry": "local",
        "pkg": {
          "type": "APPLICATION",
          "name": "zeppelin.clock",
          "description": "Clock (example)",
          "artifact": "zeppelin-examples\/zeppelin-example-clock\/target\/zeppelin-example-clock-0.7.0-SNAPSHOT.jar",
          "className": "org.apache.zeppelin.example.app.clock.Clock",
          "resources": [
            [
              ":java.util.Date"
            ]
          ],
          "icon": "icon"
        },
        "enabled": false
      }
    ]
  }
}
        

Suggest Helium package on a paragraph

Description This ```GET``` method returns suggested helium package for the paragraph.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/suggest/[Note ID]/[Paragraph ID]```
Success code 200
Fail code 404 on note or paragraph not exists
500
Sample JSON response
{
  "status": "OK",
  "message": "",
  "body": {
    "available": [
      {
        "registry": "local",
        "pkg": {
          "type": "APPLICATION",
          "name": "zeppelin.clock",
          "description": "Clock (example)",
          "artifact": "zeppelin-examples\/zeppelin-example-clock\/target\/zeppelin-example-clock-0.7.0-SNAPSHOT.jar",
          "className": "org.apache.zeppelin.example.app.clock.Clock",
          "resources": [
            [
              ":java.util.Date"
            ]
          ],
          "icon": "icon"
        },
        "enabled": true
      }
    ]
  }
}
        

Load Helium package on a paragraph

Description This ```POST``` method loads helium package to target paragraph.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/load/[Note ID]/[Paragraph ID]```
Success code 200
Fail code 404 on note or paragraph not exists
500
Sample JSON response
{
  "status": "OK",
  "message": "",
  "body": "app_2C5FYRZ1E-20170108-040449_2068241472zeppelin_clock"
}
        

Load bundled visualization script

Description This ```GET``` method returns bundled helium visualization javascript. When refresh=true (optional) is provided, Zeppelin rebuilds bundle. Otherwise, it's provided from cache
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/bundle/load/[Package Name][?refresh=true]```
Success code 200 reponse body is executable javascript
Fail code 200 reponse body is error message string starts with ERROR:

Enable package

Description This ```POST``` method enables a helium package. Needs artifact name in input payload
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/enable/[Package Name]```
Success code 200
Fail code 500
Sample input
zeppelin-examples/zeppelin-example-clock/target/zeppelin-example-clock-0.7.0-SNAPSHOT.jar
        
Sample JSON response
{"status":"OK"}
        

Disable package

Description This ```POST``` method disables a helium package.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/disable/[Package Name]```
Success code 200
Fail code 500
Sample JSON response {"status":"OK"}

Get visualization display order

Description This ```GET``` method returns display order of enabled visualization packages.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/order/visualization```
Success code 200
Fail code 500
Sample JSON response {"status":"OK","body":["zeppelin_horizontalbar","zeppelin-bubblechart"]}

Set visualization display order

Description This ```POST``` method sets visualization packages display order.
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/order/visualization```
Success code 200
Fail code 500
Sample JSON input ["zeppelin-bubblechart", "zeppelin_horizontalbar"]
Sample JSON response {"status":"OK"}

Get configuration for all Helium packages

Description This ```GET``` method returns configuration for all Helium packages
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/config```
Success code 200
Fail code 500

Get configuration for specific package

Description This ```GET``` method returns configuration for the specified package name and artifact
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/config/[Package Name]/[Artifact]```
Success code 200
Fail code 500

Set configuration for specific package

Description This ```POST``` method updates configuration for specified package name and artifact
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/config/[Package Name]/[Artifact]```
Success code 200
Fail code 500

Get Spell configuration for single package

Description This ```GET``` method returns specified package Spell configuration
URL ```http://[zeppelin-server]:[zeppelin-port]/api/helium/spell/config/[Package Name]```
Success code 200
Fail code 500