- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2022 09:31 AM
Hi, I am having an issue accessing data bricks API 2.0/workspace/mkdirs through python. I am using the below azure method to generate the access token. I am not sure why I am getting 404 any suggestions?
token_credential = DefaultAzureCredential()
scope = "2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default".
Below is the snippet of my code.
response = requests.post(
url="https://databricksurl/api/2.0/workspace/mkdir",
headers={ 'Authorization': "Bearer " + access_token,
'Accept': 'application/json'},
json = {'path' : '/user/test'}
)
print(json.dumps(json.loads(response.text), indent = 2))
print(response)
Error:
{
"error_code": "ENDPOINT_NOT_FOUND",
"message": "No API found for 'POST /workspace/mkdir'"
}
- Labels:
-
Acess Token
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 11:14 AM
Just a friendly follow-up. Did any of the responses help you to resolve your question? if it did, please mark it as best. Otherwise, please let us know if you still need help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2022 08:47 AM
@Kaniz Fatma I checked that community thread and it didn't help. I am using https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/app-aad-token to create an access token through that I am trying to access this 2.0/workspace/mkdir to create a folder in data bricks which is not working. Any suggestions?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 03:50 PM
issue is with data/json...
try the below -
from azure.identity import DefaultAzureCredential
import requests
default_scope = "2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default"
credential = DefaultAzureCredential()
token = credential.get_token(default_scope)
access_token = str(token.token)
url="https://adb-xxxxx.azuredatabricks.net/api/2.0/workspace/mkdirs"
headers={"Authorization":"Bearer "+access_token, "Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(
url=url,
headers=headers,
data = '{"path":"/dpaas-ids2/test"}'
)
print(response)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2022 03:19 PM
Yes that is correct!. It worked. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 11:14 AM
Just a friendly follow-up. Did any of the responses help you to resolve your question? if it did, please mark it as best. Otherwise, please let us know if you still need help.