You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何通过Zeppelin Rest API创建笔记本并绑定特定解释器配置?

Using Zeppelin REST API to Create a Notebook and Bind to a Specific Interpreter Configuration

Great question! Yes, you absolutely can bind a specific interpreter configuration when creating a notebook via Zeppelin's REST API—just like the dropdown selection you see in the UI. Here's a step-by-step breakdown to make this work:

Step 1: Get the ID of your target interpreter configuration

First, you need to retrieve the unique ID of the interpreter configuration you want to bind. To do this:

  • Send a GET request to:
    http://<zeppelin-host>:<port>/api/interpreter/settings
    
  • In the JSON response, look for the interpreter configuration you’re targeting (e.g., a custom Spark setup or a Python interpreter with specific environment variables). Note the id field associated with it (it’ll be a string like 2A94M5J1Z).

Step 2: Create the notebook and bind the interpreter configuration

Now use the Zeppelin notebook creation API, and include the interpreter configuration ID in your request body:

  • Send a POST request to:
    http://<zeppelin-host>:<port>/api/notebook
    
  • Use a JSON request body like this (replace placeholders with your actual values):
    {
      "name": "My Custom Interpreter Notebook",
      "note": {
        "paragraphs": []
      },
      "interpreterSettingId": "2A94M5J1Z"
    }
    
    The interpreterSettingId field is the key here—it links your new notebook directly to the specific interpreter configuration you selected.

Step 3: Verify the binding

To confirm everything worked as expected:

  • Take the notebook ID returned in the POST response (it’ll be in the body.id field).
  • Send a GET request to:
    http://<zeppelin-host>:<port>/api/notebook/<notebook-id>
    
  • Check that the interpreterSettingId in the response matches the ID you used when creating the notebook.

Quick Tips

  • If your Zeppelin instance uses authentication, don’t forget to include the appropriate authorization headers (like a Bearer token) in all your API requests to avoid permission issues.
  • You can pre-populate paragraphs in the note.paragraphs array if you want the notebook to start with specific code or text—just follow the Zeppelin paragraph JSON structure.

内容的提问来源于stack exchange,提问作者Reza Rahim

火山引擎 最新活动