API - How to get direct link to file from API results and download or recurse folder structure and download each result #7126
freedbygrace
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Using the Powershell code below and having the docker container configured behind a reverse proxy with SSL termination, I cannot figure out how to use the API to recursively download a directory or a file because the raw_url value does not come back within the API request results. Also, it would be cool if the hash we stored also for file download verification.
The following properties should be returned for optimal function
The direct download URL
The directory where the file is stored
The file name of the file
The path of the file
The hash of the file also
All of current properties
How can I accomplish this?
`$InvokeRestMethodParameters = New-Object -TypeName 'System.Collections.Specialized.OrderedDictionary'
$InvokeRestMethodParameters.Method = [Microsoft.Powershell.Commands.Webrequestmethod]::Get
$InvokeRestMethodParameters.UseBasicParsing = $True
$InvokeRestMethodParameters.Uri = "https://alist.mydomain.com/api/fs/list"
$InvokeRestMethodParameters.Headers = [Ordered]@{}
$InvokeRestMethodParameters.Headers.Authorization = "APIToken"
$InvokeRestMethodParameters.Body = [Ordered]@{}
$InvokeRestMethodParameters.Body.'path' = "/MountPath/SubDirectory"
$InvokeRestMethodParameters.Body.'password' = ""
$InvokeRestMethodParameters.Body.'page' = "1"
$InvokeRestMethodParameters.Body.'per_page' = "0"
$InvokeRestMethodParameters.Body.'refresh' = $True
$InvokeRestMethodParameters.ContentType = "application/json"
$InvokeRestMethodResults = Invoke-RestMethod @InvokeRestMethodParameters`
`name : autorun.inf
size : 128
is_dir : False
modified : 2024-04-01T13:25:05Z
created : 2024-08-28T17:58:12.7039446Z
sign : nHMaPMPt6YwhJscIuRGbprlchxFdG9gQaEZoxvAfCkM=:0
thumb :
type : 0
hashinfo : null
hash_info :
name : bootmgr
size : 473364
is_dir : False
modified : 2024-04-01T13:25:05Z
created : 2024-08-28T17:58:12.7508263Z
sign : eygf6YZ0RO7h2FLRV4fZILRmWFD4ctZN3WqDiOBPaIQ=:0
thumb :
type : 0
hashinfo : null
hash_info :
name : bootmgr.efi
size : 2744752
is_dir : False
modified : 2024-04-01T13:25:05Z
created : 2024-08-28T17:58:12.953954Z
sign : KAhvfxzNMcbjiHrpcyKtKZjsBhJLnGXcq0e-bnTbc9g=:0
thumb :
type : 0
hashinfo : null
hash_info :
name : setup.exe
size : 99896
is_dir : False
modified : 2024-04-01T13:25:05Z
created : 2024-08-28T17:58:13.0008312Z
sign : h93Imxk7u4hgsBos-i4ycH-VLIUxbZiw3n10wM8hdAM=:0
thumb :
type : 0
hashinfo : null
hash_info : `
Beta Was this translation helpful? Give feedback.
All reactions