cancel
Showing results for 
Search instead for 
Did you mean: 
Data Governance
Join discussions on data governance practices, compliance, and security within the Databricks Community. Exchange strategies and insights to ensure data integrity and regulatory compliance.
cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to get json response for "/api/2.0/accounts/{account_id}/metastores" endpoint.

nikhilkumawat
New Contributor III

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.

metastore_response 

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 ?

1 ACCEPTED SOLUTION

Accepted Solutions

ruben1
New Contributor III

Apparently, it is working if I add the header `X-Databricks-Account-Console-API-Version` with value `2.0` to the call

View solution in original post

2 REPLIES 2

ruben1
New Contributor III

I'm having exactly the same problem. Seems a bug in the API.

ruben1
New Contributor III

Apparently, it is working if I add the header `X-Databricks-Account-Console-API-Version` with value `2.0` to the call

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group