cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not able to access the folders inside scoped app folder

Not able to access the folders inside scoped app folder

nive
Explorer | Level 4

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 while Im running the script it says :

Invoke-RestMethod : {"error_summary": "path/not_found/...", "error": {".tag": "path", "path": {".tag": "not_found"}}}  

The app has read and write access . Why does this error occur . Also this app is created by another person and has been shared .

12 Replies 12

karver
New member | Level 2

i need to download zip file from dropbox

 

this is the error i am receiving :

Invoke-RestMethod : {"error_summary": "path/not_found/...", "error": {".tag": "path", "path": {".tag": "not_found"}}}

 

My script looks like this

 

function Get-DropboxFolder{

    [CmdletBinding()]
    Param(
        [string]$DropboxFolder,
        [string]$OutputFolder,
        [string]$FolderPath
    )
    $body = '{"path":"/'+$DropboxFolder+'"}'

    Write-Output $body
    $AuthToken = 'xxxxxxxx'
    $token = "Bearer $AuthToken"
   
    #The file will be downloaded as ZIP to the Temp folder of the user
    $Tempfolder = "$env:temp\Downloaded_File.zip"

    if (!(Test-Path $FolderPath)) {
        Write-Verbose "Downloading the folder…"
        Invoke-RestMethod `
                -Method POST `
                -Uri "https://content.dropboxapi.com/2/files/download" `
                -Headers @{ "Authorization" = $token; "Dropbox-API-Arg" = $body} `
                -OutFile $Tempfolder -ContentType ""
       
        #The file will be extracted and then removed from the temp
        write-verbose "Extracting the folder…"
        Expand-Archive -LiteralPath $Tempfolder -DestinationPath $OutputFolder -Force
        Remove-Item $Tempfolder -Force
        Write-Verbose "The folder has been downloaded."
    }
    else{
        Write-Verbose "Folder Exists"
    }
}

$DropboxFolder    = "Apps/WAE-DE-dev-win11/file.zip"
$OutputFolder  = "$env:HOMEDRIVE\Softwares"
$FolderPath    = "$OutputFolder\Software01"

Get-DropboxFolder -DropboxFolder $DropboxFolder -OutputFolder $OutputFolder -FolderPath $FolderPath -Verbose

Greg-DB
Dropbox Staff

@karver Apps with the "app folder" access type can only access the contents of the special app folder that gets automatically created for it. If your app has the "app folder" access type, then it will only be able to access files in the app folder, and the root for any path value supplied by that app will automatically be the app folder root. You can find more information on app permissions here. For example, If your app has the app folder access type and you're trying to access something you can see on the Dropbox web site at "/Apps/<app folder name>/folder/example.csv", you should only send the path value as "/folder/example.csv".

 

So in your case, instead of this line:

$DropboxFolder    = "Apps/WAE-DE-dev-win11/file.zip"

try it like this:

$DropboxFolder    = "file.zip"

Здравко
Legendary | Level 20

Hi @karver,

You have 2 errors, at least. The first one is obvious - you have pointed something that doesn't exist (likely it's the same as explained before; not mandatory, of course). The other one is the fact that you're trying to download folder content using method suitable for files only! To be able download a folder as zip file take a look on /2/files/download_zip. :winking_face:

Hope this gives direction.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    karver New member | Level 2
  • User avatar
    nive Explorer | Level 4
What do Dropbox user levels mean?