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 ?