<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to use Databricks REST API within a notebook without providing tokens in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-use-databricks-rest-api-within-a-notebook-without/m-p/20878#M14139</link>
    <description>&lt;P&gt;Disclaimer: This code snippet uses an internal API. It's not recommended to use internal API's in your application as they are subject to change or discontinuity. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%python
import requests
 
API_URL = dbutils.notebook.entry_point.getDbutils().notebook().getContext().apiUrl().getOrElse(None)
TOKEN = dbutils.notebook.entry_point.getDbutils().notebook().getContext().apiToken().getOrElse(None)
 
response = requests.get(
  API_URL + '/api/2.0/clusters/list',
  headers={"Authorization": "Bearer " + TOKEN},
)
 
if response.status_code == 200:
  print [c['cluster_id'] for c in response.json()['clusters']]
else:
  print("Error: %s: %s" % (response.json()["error_code"], response.json()["message"]))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Jun 2021 06:20:02 GMT</pubDate>
    <dc:creator>brickster_2018</dc:creator>
    <dc:date>2021-06-24T06:20:02Z</dc:date>
    <item>
      <title>How to use Databricks REST API within a notebook without providing tokens</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-databricks-rest-api-within-a-notebook-without/m-p/20877#M14138</link>
      <description />
      <pubDate>Thu, 24 Jun 2021 06:00:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-databricks-rest-api-within-a-notebook-without/m-p/20877#M14138</guid>
      <dc:creator>brickster_2018</dc:creator>
      <dc:date>2021-06-24T06:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Databricks REST API within a notebook without providing tokens</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-databricks-rest-api-within-a-notebook-without/m-p/20878#M14139</link>
      <description>&lt;P&gt;Disclaimer: This code snippet uses an internal API. It's not recommended to use internal API's in your application as they are subject to change or discontinuity. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%python
import requests
 
API_URL = dbutils.notebook.entry_point.getDbutils().notebook().getContext().apiUrl().getOrElse(None)
TOKEN = dbutils.notebook.entry_point.getDbutils().notebook().getContext().apiToken().getOrElse(None)
 
response = requests.get(
  API_URL + '/api/2.0/clusters/list',
  headers={"Authorization": "Bearer " + TOKEN},
)
 
if response.status_code == 200:
  print [c['cluster_id'] for c in response.json()['clusters']]
else:
  print("Error: %s: %s" % (response.json()["error_code"], response.json()["message"]))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 06:20:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-databricks-rest-api-within-a-notebook-without/m-p/20878#M14139</guid>
      <dc:creator>brickster_2018</dc:creator>
      <dc:date>2021-06-24T06:20:02Z</dc:date>
    </item>
  </channel>
</rss>

