解释器 API
原文链接 : http://zeppelin.apache.org/docs/0.7.2/rest-api/rest-interpreter.html
译文链接 : https://www.apachecn.org/pages/viewpage.action?pageId=10030697
Overview ( 概述 )
Apache Zeppelin 提供了几个 REST API ,用于交互和远程激活 zeppelin 功能。所有 REST API 都可以从以下端点。请注意,Apache Zeppelin REST API 接收或返回 JSON 对象,建议您安装 JSON 查看器如 JSONView 。
如果您使用 Apache Zeppelin 并发现需要一个额外的 REST API ,请 提出问题或向我们发送电子邮件 。
解释器REST API列表
这里介绍了 registered interpreters , settings ( 设置 ) 和 interpreters group 的作用。
注册解释器人员名单
| 描述 | 该 GET 方法返回服务器上可用的 all the registered interpreters ( 所有已注册的解释器 ) 。 | | URL | http://[zeppelin-server]:[zeppelin-port]/api/interpreter | | 成功代码 | 200 | | 失败代码 | 500 | | JSON 响应示例 |
{
"status": "OK",
"message": "",
"body": {
"md.md": {
"name": "md",
"group": "md",
"className": "org.apache.zeppelin.markdown.Markdown",
"properties": {},
"path": "/zeppelin/interpreter/md"
},
"spark.spark": {
"name": "spark",
"group": "spark",
"className": "org.apache.zeppelin.spark.SparkInterpreter",
"properties": {
"spark.executor.memory": {
"defaultValue": "1g",
"description": "Executor memory per worker instance. ex) 512m, 32g"
},
"spark.cores.max": {
"defaultValue": "",
"description": "Total number of cores to use. Empty value uses all available core."
},
},
"path": "/zeppelin/interpreter/spark"
},
"spark.sql": {
"name": "sql",
"group": "spark",
"className": "org.apache.zeppelin.spark.SparkSqlInterpreter",
"properties": {
"zeppelin.spark.maxResult": {
"defaultValue": "1000",
"description": "Max number of Spark SQL result to display."
}
},
"path": "/zeppelin/interpreter/spark"
}
}
}
|
注册解释器设定清单
| 描述 | 该 GET 方法返回服务器上注册的所有解释器设置。 | | URL | http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting | | 成功代码 | 200 | | 失败代码 | 500 | | JSON 响应示例 |
{
"status": "OK",
"message": "",
"body": [
{
"id": "2AYUGP2D5",
"name": "md",
"group": "md",
"properties": {
"empty": ""
},
"interpreterGroup": [
{
"class": "org.apache.zeppelin.markdown.Markdown",
"name": "md"
}
],
"dependencies": []
},
{
"id": "2AY6GV7Q3",
"name": "spark",
"group": "spark",
"properties": {
"spark.cores.max": "",
"spark.executor.memory": "1g",
},
"interpreterGroup": [
{
"class": "org.apache.zeppelin.spark.SparkInterpreter",
"name": "spark"
},
{
"class": "org.apache.zeppelin.spark.SparkSqlInterpreter",
"name": "sql"
}
],
"dependencies": [
{
"groupArtifactVersion": "com.databricks:spark-csv_2.10:1.3.0"
}
]
}
]
}
|
通过设置 ID 获取注册的解释器设置
| 描述 | 该 GET 方法在服务器上返回已注册的解释器设置 | | URL | http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting/[setting ID] | | 成功代码 | 200 | | 失败代码 | 400 如果这样的解释器设置 id 不存在500 任何其他错误 | | JSON 响应示例 |
{
"status": "OK",
"message": "",
"body": {
"id": "2AYW25ANY",
"name": "Markdown setting name",
"group": "md",
"properties": {
"propname": "propvalue"
},
"interpreterGroup": [
{
"class": "org.apache.zeppelin.markdown.Markdown",
"name": "md"
}
],
"dependencies": [
{
"groupArtifactVersion": "groupId:artifactId:version",
"exclusions": [
"groupId:artifactId"
]
}
]
}
}
|
创建一个新的解释器设置
| 描述 | 此 POST 方法使用注册的解释器将新的解释器设置添加到服务器。 | | URL | http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting | | 成功代码 | 201 | | 失败代码 | 400 如果输入 JSON 为空500 则为其他任何错误 | | 示例 JSON 输入 |
{
"name": "Markdown setting name",
"group": "md",
"properties": {
"propname": "propvalue"
},
"interpreterGroup": [
{
"class": "org.apache.zeppelin.markdown.Markdown",
"name": "md"
}
],
"dependencies": [
{
"groupArtifactVersion": "groupId:artifactId:version",
"exclusions": [
"groupId:artifactId"
]
}
]
}
| | 示例 JSON 响应 |
{
"status": "CREATED",
"message": "",
"body": {
"id": "2AYW25ANY",
"name": "Markdown setting name",
"group": "md",
"properties": {
"propname": "propvalue"
},
"interpreterGroup": [
{
"class": "org.apache.zeppelin.markdown.Markdown",
"name": "md"
}
],
"dependencies": [
{
"groupArtifactVersion": "groupId:artifactId:version",
"exclusions": [
"groupId:artifactId"
]
}
]
}
}
|
更新解释器设置
| 描述 | 此 PUT 方法使用新属性更新解释器设置 | | URL | http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting/[interpreter ID] | | 成功代码 | 200 | | 失败代码 | 500 | | 示例 JSON 输入 |
{
"name": "Markdown setting name",
"group": "md",
"properties": {
"propname": "Otherpropvalue"
},
"interpreterGroup": [
{
"class": "org.apache.zeppelin.markdown.Markdown",
"name": "md"
}
],
"dependencies": [
{
"groupArtifactVersion": "groupId:artifactId:version",
"exclusions": [
"groupId:artifactId"
]
}
]
}
| | 示例 JSON 响应 |
{
"status": "OK",
"message": "",
"body": {
"id": "2AYW25ANY",
"name": "Markdown setting name",
"group": "md",
"properties": {
"propname": "Otherpropvalue"
},
"interpreterGroup": [
{
"class": "org.apache.zeppelin.markdown.Markdown",
"name": "md"
}
],
"dependencies": [
{
"groupArtifactVersion": "groupId:artifactId:version",
"exclusions": [
"groupId:artifactId"
]
}
]
}
}
|
删除解释器设置
| 描述 | 此 DELETE 方法删除给定的解释器设置 | | URL | http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting/[interpreter ID] | | 成功代码 | 200 | | 失败代码 | 500 | | 示例 JSON 响应 | {"status":"OK"} |
重新启动解释器
| 描述 | 此 PUT 方法重新启动给定的解释器标识。 | | URL | http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting/restart/[interpreter ID] | | 成功代码 | 200 | | 失败代码 | 500 | | JSON 输入示例(可选) |
{
“noteId”:“2AVQJVC8N”
}
| | 示例 JSON 响应 | {"status":"OK"} |
添加用于依赖关系解析的新存储库
| 描述 | 此 POST 方法添加新的存储库。 | | URL | http://[zeppelin-server]:[zeppelin-port]/api/interpreter/repository | | 成功代码 | 201 | | 失败代码 | 500 | | 示例 JSON 输入 |
{
"id": "securecentral",
"url": "https://repo1.maven.org/maven2",
"snapshot": false
}
| | 示例 JSON 响应 | {"status":"OK"} |
删除依赖关系解析的存储库
| 描述 | 此 DELETE 方法删除具有给定 ID 的存储库。 | | URL | http://[zeppelin-server]:[zeppelin-port]/api/interpreter/repository/[repository ID] | | 成功代码 | 200 | | 失败代码 | 500 |