Zeppelin解釋器的REST API接口

Zeppelin解釋器的REST API接口

概覽

Apache Zeppelin 提供了多個REST APIs用於遠程功能交互操做。 全部的REST APIs 都經過 endpoint http://[zeppelin-server]:[zeppelin-port]/api 進行操做。注意,Apache Zeppelin 的REST APIs 都接受和返回 JSON 對象, 建議安裝 JSON viewers, 好比 JSONViewhtml

若是你使用Apache Zeppelin ,發現對其它的 REST API需求, 能夠到這裏去提出來或者發送電子郵件給咱們: send us an email.web

解釋器 REST API 列表

註冊的解釋器做用、設置的描述,參考 heresql

註冊的 interpreters列表

Description This GET method returns all the registered interpreters available on the server.
URL http://[zeppelin-server]:[zeppelin-port]/api/interpreter
Success code 200
Fail code 500
Sample JSON response
{
  "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"
    }
  }
}

註冊的 interpreter 設置列表

Description This GET method returns all the interpreters settings registered on the server.
URL http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting
Success code 200
Fail code 500
Sample JSON response
{
  "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獲得註冊 interpreter 設置

Description This GET method returns a registered interpreter setting on the server.
URL http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting/[setting ID]
Success code 200
Fail code 400 if such interpreter setting id does not exist
500 for any other errors
Sample JSON response
{
  "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"
        ]
      }
    ]
  }
}

 

建立新的 interpreter 設置

Description This POST method adds a new interpreter setting using a registered interpreter to the server.
URL http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting
Success code 200
Fail code 400 if the input json is empty
500 for any other errors
Sample JSON input
{
  "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"
      ]
    }
  ]
}
Sample JSON response
{
  "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"
        ]
      }
    ]
  }
}

 

更新 interpreter 設置

Description This PUT method updates an interpreter setting with new properties.
URL http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting/[interpreter ID]
Success code 200
Fail code 500
Sample JSON input
{
  "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"
      ]
    }
  ]
}
Sample JSON response
{
  "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"
        ]
      }
    ]
  }
}

刪除 interpreter 設置

Description This DELETE method deletes an given interpreter setting.
URL http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting/[interpreter ID]
Success code 200
Fail code 500
Sample JSON response {"status":"OK"}

從新啓動 interpreter

Description This PUT method restarts the given interpreter id.
URL http://[zeppelin-server]:[zeppelin-port]/api/interpreter/setting/restart/[interpreter ID]
Success code 200
Fail code 500
Sample JSON input (Optional)
{
  "noteId": "2AVQJVC8N"
}
Sample JSON response {"status":"OK"}

 

添加新的 repository到依賴性引用

Description This POST method adds new repository.
URL http://[zeppelin-server]:[zeppelin-port]/api/interpreter/repository
Success code 200
Fail code 500
Sample JSON input
{
  "id": "securecentral",
  "url": "https://repo1.maven.org/maven2",
  "snapshot": false
}
Sample JSON response {"status":"OK"}

 

刪除依賴性引用的 repository

Description This DELETE method delete repository with given id.
URL http://[zeppelin-server]:[zeppelin-port]/api/interpreter/repository/[repository ID]
Success code 200
Fail code

500chrome

原文(英):http://zeppelin.apache.org/docs/0.8.0-SNAPSHOT/rest-api/rest-interpreter.htmlapache

相關文章
相關標籤/搜索