I'm trying to download an Artifactory folder as a tar.gz file using the PowerShell command line. In Bash, the following command does the job:
curl -i -v -XGET -H 'X-JFrog-Art-Api:<my API key>' "https://artifactory.<myrepo.com>/path/to/files?archiveType=tar.gz" --output ./file_location/filename.tar.gz
In PowerShell, however, this doesn't seem to work:
Invoke-RestMethod -uri "https://artifactory.<myrepo.com>/path/to/files?archiveType=tar.gz" -Method 'Get' -OutFile .\file_location\filename.tar.gz -H @{'X-JFrog-Art-Api' ='<my API key>';'Content-Type'='multipart/form-data'}
This operation creates filename.tar.gz, but the file is just a HTML file giving the directory structure rather than the actual files.
If I only want an individual file, I can use PowerShell to download files (not an archive) with:
Invoke-RestMethod -uri "https://artifactory.<myrepo.com>/path/to/files/filename.xyz" -Method 'Get' -OutFile .\file_location\filename.xyz -H @{'X-JFrog-Art-Api' ='<my API key>';'Content-Type'='multipart/form-data'}
And filename.xyz is transferred to the local machine. So I'm a bit confused with why the tool to make an archive fails.