如何通过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
GETrequest 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
idfield associated with it (it’ll be a string like2A94M5J1Z).
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
POSTrequest to:http://<zeppelin-host>:<port>/api/notebook - Use a JSON request body like this (replace placeholders with your actual values):
The{ "name": "My Custom Interpreter Notebook", "note": { "paragraphs": [] }, "interpreterSettingId": "2A94M5J1Z" }interpreterSettingIdfield 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
POSTresponse (it’ll be in thebody.idfield). - Send a
GETrequest to:http://<zeppelin-host>:<port>/api/notebook/<notebook-id> - Check that the
interpreterSettingIdin 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.paragraphsarray if you want the notebook to start with specific code or text—just follow the Zeppelin paragraph JSON structure.
内容的提问来源于stack exchange,提问作者Reza Rahim




