🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# Helium API 原文链接 : [http://zeppelin.apache.org/docs/0.7.2/rest-api/rest-helium.html](http://zeppelin.apache.org/docs/0.7.2/rest-api/rest-helium.html) 译文链接 : [http://www.apache.wiki/pages/viewpage.action?pageId=10031086](http://www.apache.wiki/pages/viewpage.action?pageId=10031086) 贡献者 : [片刻](/display/~jiangzhonglian) [ApacheCN](/display/~apachecn) [Apache中文网](/display/~apachechina) ## 概观 Apache Zeppelin提供了几个REST API,用于交互和远程激活zeppelin功能。所有REST API都可以从以下端点开始`http://[zeppelin-server]:[zeppelin-port]/api`。需要注意的是Apache的齐柏林飞艇的REST API接收或返回JSON对象,建议你安装一些JSON观众如[JSONView](https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc)。 如果您使用Apache Zeppelin并发现需要一个额外的REST API,请[提出问题或向我们发送电子邮件](http://zeppelin.apache.org/community.html)。 [ ](http://zeppelin.apache.org/docs/0.7.2/rest-api/rest-helium.html#helium-rest-api-list) ## 氦REST API列表 ### 所有可用氦气包的清单 | 描述 | 此`GET`方法返回已配置注册表中的所有可用氦包。 | | 网址 | `http://[zeppelin-server]:[zeppelin-port]/api/helium/all` | | 成功代码 | 200 | | 失败代码 | 500 | | 示例JSON响应 | ``` { "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 } ], "zeppelin-bubblechart": [ { "registry": "local", "pkg": { "type": "VISUALIZATION", "name": "zeppelin-bubblechart", "description": "Animated bubble chart", "artifact": ".\/..\/helium\/zeppelin-bubble", "icon": "icon" }, "enabled": true }, { "registry": "local", "pkg": { "type": "VISUALIZATION", "name": "zeppelin-bubblechart", "description": "Animated bubble chart", "artifact": "zeppelin-bubblechart@0.0.2", "icon": "icon" }, "enabled": false } ], "zeppelin_horizontalbar": [ { "registry": "local", "pkg": { "type": "VISUALIZATION", "name": "zeppelin_horizontalbar", "description": "Horizontal Bar chart (example)", "artifact": ".\/zeppelin-examples\/zeppelin-example-horizontalbar", "icon": "icon" }, "enabled": true } ] } }  ``` | ### 建议氦气应用 | 描述 | 该`GET`方法返回段落的建议氦气应用。 | | 网址 | `http://[zeppelin-server]:[zeppelin-port]/api/helium/suggest/[Note ID]/[Paragraph ID]` | | 成功代码 | 200 | | 失败代码 | 404注释或段落不存在 500 | | 示例JSON响应 | ``` { "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 } ] } } ``` | ### **在一个段落上加载氦气应用程序** | 描述 | 此`GET`方法在成功时返回氦应用程序ID。 | | 网址 | `http://[zeppelin-server]:[zeppelin-port]/api/helium/load/[Note ID]/[Paragraph ID]` | | 成功代码 | 200 | | 失败代码 | 404的注释或段落不存在 500任何其他错误 | | 示例JSON响应 | ``` { "status": "OK", "message": "", "body": "app2C5FYRZ1E-20170108-0404492068241472zeppelin_clock" } ``` | ### **加载捆绑的可视化脚本** | 描述 | 此`GET`方法返回捆绑的氦可视化javascript。当提供refresh = true(可选)时,Zeppelin重建包。否则,从缓存提供 | | 网址 | `http://[zeppelin-server]:[zeppelin-port]/api/helium/visualizations/load[?refresh=true]` | | 成功代码 | 200回复体是可执行的javascript | | 失败代码 | 200响应体是错误消息字符串以ERROR开头: | ### **启用包** | 描述 | 这种`POST`方法可以实现氦气包装。需要输入有效载荷中的工件名称 | | 网址 | `http://[zeppelin-server]:[zeppelin-port]/api/helium/enable/[Package Name]` | | 成功代码 | 200 | | 失败代码 | 500 | | 样品输入 | ``` 飞艇-实例/飞艇-例如时钟/目标/飞艇-例如时钟-0.7.0-SNAPSHOT.jar ``` | | 示例JSON响应 | ``` {"status":"OK"} ``` | ### **禁用包** | 描述 | 该`POST`方法禁用氦气包。 | | 网址 | `http://[zeppelin-server]:[zeppelin-port]/api/helium/disable/[Package Name]` | | 成功代码 | 200 | | 失败代码 | 500 | | 示例JSON响应 | ``` {"status":"OK"} ``` | ### 获取可视化显示顺序[](http://zeppelin.apache.org/docs/0.7.2/rest-api/rest-helium.html#get-visualization-display-order) | 描述 | 此`GET`方法返回启用的可视化包的显示顺序。 | | 网址 | `http://[zeppelin-server]:[zeppelin-port]/api/helium/visualizationOrder` | | 成功代码 | 200 | | 失败代码 | 500 | | 示例JSON响应 | {"status":"OK","body":["zeppelin_horizontalbar","zeppelin-bubblechart"]} | ### 设置可视化显示顺序[](http://zeppelin.apache.org/docs/0.7.2/rest-api/rest-helium.html#set-visualization-display-order) | 描述 | 此`POST`方法设置可视化包显示顺序。 | | 网址 | `http://[zeppelin-server]:[zeppelin-port]/api/helium/visualizationOrder` | | 成功代码 | 200 | | 失败代码 | 500 | | 示例JSON输入 | ["zeppelin-bubblechart", "zeppelin_horizontalbar"] | | 示例JSON响应 | ``` {"status":"OK"} ``` |