cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

dbfs rest api - Access denied on dbfs rest api call but access works in dataricks notebook

PrData05
New Contributor II

Hello, 

We are trying to interact with dbfs to upload files and list files in dbfs directory ( we are tring to upload files in volumes ). Although we have necessary permissions on databricks, we are still getting permission denied when we are making rest api calls.

We are able to work successfully on databricks notebooks with same permissions. 

error code when we are trying to list files in a directory 

{"error_code":"PERMISSION_DENIED","message":"No operations allowed on this path"}

erorr when we are trying to upload files in a directory:

{"error_code":"INVALID_PARAMETER_VALUE","message":"You must provide the upload path!"}

 

the request to upload file looks like this:

{'path': 'dbfs:/Volumes/sandbox/managed/mvolume/new_file.json', 'contents': 'SGVsbG8sIFdvcmxkIQ=', 'overwrite': 'true'}

 

Any leads why this is not working, would be appreciated. Thank you ๐Ÿ™‚

 

5 REPLIES 5

PrData05
New Contributor II

Hi @Retired_mod , I verified , the upload path is correct and I am passing the correct path in the request. 

TheIceBrick
New Contributor III

@PrData05 did you get anywhere with uploading to a volume? This has been suggested as a workaround for uploading to a volume using the dbfs api, but I am getting the same results.

the api didn't work for me ,so I used databricks sdk to upload files.

I used WorkspaceClient's upload method. Here's the sample that might help

workspace_client = WorkspaceClient(
        host = SERVER_HOSTNAME,
        token = ACCESS_TOKEN
    )
response = workspace_client.files.upload(file_path, content)

.  

sgdnp
New Contributor II

I am experiencing the same issue as well. Any ideas about how we can upload to volumes using the api? Tried both the /api/2.0/dbfs/put and the streaming apis (/api/2.0/dbfs/create,/api/2.0/dbfs/add-block,/api/2.0/dbfs/close) but no luck so getting it to work.

PrData05
New Contributor II

the api didn't work for me ,so I used databricks sdk to upload files.

I used WorkspaceClient's upload method. Here's the sample that might help

 

workspace_client = WorkspaceClient(
        host = SERVER_HOSTNAME,
        token = ACCESS_TOKEN
    )
response = workspace_client.files.upload(file_path, content)

 

.  

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