- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 01:05 AM
Hi ,
I am trying to get list of all the metastores associated with an accountId. For this I am using the below REST API to get data:
accountId = json.loads(dbutils.notebook.entry_point.getDbutils().notebook().getContext().toJson())["tags"]["accountId"]
print(accountId)
url = 'https://accounts.cloud.databricks.com/api/2.0/accounts/{}/metastores'.format(accountId)
response = requests.get(url, auth=("<USERNAME>","<PASSWORD>"))
response.content
I have proper admin access and the response I get here is an HTML response, not a JSON one.
Just to verify I also tried to use "Workspace" API like below:
accountId = json.loads(dbutils.notebook.entry_point.getDbutils().notebook().getContext().toJson())["tags"]["accountId"]
print(accountId)
url = 'https://accounts.cloud.databricks.com/api/2.0/accounts/{}/workspaces'.format(accountId)
response = requests.get(url, auth=("<USERNAME>","<PASSWORD>"))
response.content
This gives a proper JSON response.
So can someone help in what am I doing wrong while hitting "Metastore" endpoint ? And how to get proper JSON response out of it ?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 05:55 AM
Apparently, it is working if I add the header `X-Databricks-Account-Console-API-Version` with value `2.0` to the call
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 05:50 AM
I'm having exactly the same problem. Seems a bug in the API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 05:55 AM
Apparently, it is working if I add the header `X-Databricks-Account-Console-API-Version` with value `2.0` to the call

