We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
nive
3 years agoExplorer | Level 4
Not able to access the folders inside scoped app folder
There is a scoped app folder , and Im trying to access a zip file in a folder called "myfolder" in the Apps folder . In the script , I gave the dropbox path as /Apps/myfolder/download.zip , however ...
nive
3 years agoExplorer | Level 4
Hello @ Здравко ,
My teammate has created a "App folder" and the app name is "CISCAT" . The app has been shared and also access tokens are generated .
There is a folder inside /Apps called "CIS_CAT" that I need to access . This is the powershell code Im using to access the /Apps folder .
$dropboxToken = $response.access_token
$dropboxFilePath = "/Apps/CIS_CAT/CIS-CAT-Assessor-windows-GUI-jre-v4.30.0.zip"
$localDestination = "\\CIS-CAT\CIS-CAT-Assessor-windows-GUI-jre-v4.30.0.zip" # shared drive
# Construct the Dropbox API request URL
$apiUrl = "https://content.dropboxapi.com/2/files/download"
# Set the headers for the API request
$headers = @{
Authorization = "Bearer $dropboxToken"
"Dropbox-API-Arg" = '{"path":"' + $dropboxFilePath + '"}'
}
# Make the API request to download the file
Invoke-RestMethod -Uri $apiUrl -Headers $headers -OutFile $localDestination
I get the error as "path not found" . Should the Apps folder and its contents be shared too ?
Здравко
3 years agoLegendary | Level 20
Hi again nive,
You give different values for the path in Dropbox: In your first post "/Apps/myfolder/download.zip", but in second - "/Apps/CIS_CAT/CIS-CAT-Assessor-windows-GUI-jre-v4.30.0.zip"! This is important since you application name is "CISCAT", it can see only folder "/Apps/CIS_CAT/", as a root, and its content, but nothing outside. One note here: either application name missing one underbar or in the folder name is one more underbar! 🧐 I will suppose typing error. So, your application can never see a folder like "/Apps/myfolder/" or any of the folder content! Take this in mind. Here I'm not sure if my first bet above (inaccessible place) is correct; I will let you to decide.
Further since your application have access to "App folder" only, it appears to be the root of the accessible namespace! As a result you have to strip out from your path any leading part that contains the application folder itself - something you haven't done. Following this rule, the following line:
$dropboxFilePath = "/Apps/CIS_CAT/CIS-CAT-Assessor-windows-GUI-jre-v4.30.0.zip"
... should look something like:
$dropboxFilePath = "/CIS-CAT-Assessor-windows-GUI-jre-v4.30.0.zip"
i.e. stripped "/Apps/CIS_CAT" your application specific folder that appears as root from your application view point. You can think as this folder is automatically prepend to specified path. That's why with your code you're trying to download a file like "/Apps/CIS_CAT/Apps/CIS_CAT/CIS-CAT-Assessor-windows-GUI-jre-v4.30.0.zip", that of course doesn't exist. That's where the error comes from. 😀 The second bet confirmed true. 😉
Hope this helps.
Add: Take in mind that access tokens are short lived. For long term access, if you need such, consider refresh token usage.
- nive3 years agoExplorer | Level 4
Correct me if I'm wrong , So the app name "CISCAT" and the folder name inside /Apps should be the same ? Asking so , because the folder name is CIS_CAT( with an underscore) . And thank you for the path correction , Ill try that .
Also when I try to create "App folder" or "full dropbox" in my dropbox account , I dont see the Apps folder getting created . is there any reason that Im not able to see it in my account ?
Thank you for your response .
- Здравко3 years agoLegendary | Level 20
nive wrote:Correct me if I'm wrong , So the app name "CISCAT" and the folder name inside /Apps should be the same ? Asking so , because the folder name is CIS_CAT( with an underscore) . And thank you for the path correction , Ill try that .
...
Hm...🤔 Yes and no. In general that's the rule. As can be seen in Dropbox documentation:
App folderA dedicated folder named after your app is created within the Apps folder of a user's Dropbox. ...
So, Yes, when created such a folder should have the same name as the application name.
On other side the application name can change and that change is not retroactive. Also the user can change any shared folder name (app folder behave like a shared folder between the user and the application) without this change affect any other peer. So, No, in spite typically the same, in some corner cases, the name can be different without issue.
In all cases you have to make sure the particular folder belong to your application if there's any doubts. An easy way is just upload a dummy file in you application namespace root and see where this file will bring up. Another way is to list the content of your application namespace root and see what's the result matching to.
nive wrote:...
Also when I try to create "App folder" or "full dropbox" in my dropbox account , I dont see the Apps folder getting created . is there any reason that Im not able to see it in my account ?
...
First, take in mind that when your application has "Full Dropbox" access, nothing is created automatic. Application' root and account' root coincide. So, you cannot expect something to be created automatically, without your application's explicit action.
As mentioned already, when "App Folder" is in use, application' root doesn't match to account' root (or user' home). That's why a folder, responsible for mounting application' root, gets created on application link to particular account. By default this mount point has the form "/Apps/<YOU APP NAME>", where "<YOU APP NAME>" is your application name at link moment.
I don't know if you noticed, I mentioned just before, that app folder "gets created on application link to particular account", not on application creation (as is in your question)! Doesn't matter that the application is created in your account context, it's not linked to there automatic! You have to link it there the same as you may link it to any other account if that's what confuses you. Did you link your application to your account? 🧐😉
Hope this sheds additional light.
- nive3 years agoExplorer | Level 4
Hello @Здравко ,
Thank you so much for your solution . I fixed the issue . I greatly appreciate your quick help 🙂
- DB-Des3 years ago
Dropbox Community Moderator
Hi there!
In addition to the information that Здравко has provided, I would recommend ensuring your app is an app with "App folder" access and not "Full Dropbox" access.
You can confirm this in the developer account's App Console. The app should have "Permission type: App folder".
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!