In this post, we will see how to resolve Unable to list the files using RestAPI in Databricks
Question:I am admin of databricks workspace, created PAT token to make API call but continue to get unauthorized access error while trying to check if a folder exist or not using the below code
Best Answer:In general you will receive
Unauthorized accesserror when right credentials or enough permissions are not provided for the token. I have used the same script as yours and could able to retrieve the desired results after directly generating my token from
databrick's User Settings >> Access tokens >> Generate new token >> Generate.
Make sure you are pointing to the right folder. Below is the complete script that I worked for me to retrieve files from databricks.
Note: I have contributor role for my databricks workspace
If you have better answer, please add a comment about this, thank you!