Is there a way to list the files in a storage bucket in cloud orchestrator via API?

I’m using swagger docs and making a ton of other calls. I have authentication and all of that down. Not having issues there. But I cannot figure out how to download the files in a storage bucket via API, or at least list the names/paths so I can download them in a loop. Anyone know how I can do this without knowing the file names/paths first? (I am trying to do this between multiple tenants, so I can’t use the activity since it only works in the current tenant it is running in.)

Hey @Logan.Albrecht,

Unfortunately there is no out-of-the-box API call for listing or downloading files from a storage bucket by file name. You would need to implement your own tracking mechanism to know what to download later like saving files with today’s date or hourly, monthly etc.

1 Like

Hi @Logan.Albrecht

Check below thread for a way to identify what api calls/endpoints are being used for a particular operation if it’s not documented well in swagger doc.

It’s suggested that A good way to determine what the API calls are if it is not well documented in the Support Docs or Swagger is to Inspect your Network Traffic while taking the actions in your Browser with the orchestrator Web UI.

Hope this helps.

Regards
Sonali

@Logan.Albrecht

Please check he below end points to get the files and then get the download url as well


Cheers

Is it not possible to identify the tenant list first and loop through each tenant and do the operation to download storage bucker files from each tenant?

That GetFiles call is what I have been trying to use. I havent been able to get it to work. I need the code to be dynamic and get whatever files are in the bucket at the base level, no subfolders or anything. So I assume I need to get a list of the file names/paths and use the GetReadUri on each one, but I can’t figure out how to get the file names/paths without knowing what they are in the first place.

Hi @Logan.Albrecht

You can follow below approach:

  1. Get your bucket id using /odata/Buckets
  2. Use below url to get files in your bucket

/odata/Buckets({bucket id from step 1 goes here})/UiPath.Server.Configuration.OData.GetFiles?directory=%2F&recursive=false

this would give you response like below:

  1. Now deserialize this json response to fetch all values of “FullPath”. this is the path for your files in storage buckets.

  2. Now run loop for all the full path values fetched after step3.

  3. for each path, hit the url like below:

/odata/Buckets({bucket id from step 1 goes here})/UiPath.Server.Configuration.OData.GetReadUri?path={full path fetched in last step goes here}

this step gives response as below:

“Uri” here is the direct download link of the file.

then you should be able to use download file from url activity to download the same.

Hope this helps.

Regards
Sonali

@Logan.Albrecht

please note that i have shared relative urls…

you will have to complete it like below:

https://cloud.uipath.com/{your organization name}/{your tenant name}/odata/Buckets({your bucket id})/UiPath.Server.Configuration.OData.GetFiles?directory=%2F&recursive=true

according to the tenant provided, you will be able to fetch the storage bucket files..

additonally, to get the bucket id, and then fetch the files also, you will need header as below:

X-UiPath-OrganizationUnitId → this will be the folder id of the folder where storage bucket exists and where to fetch storage bucket files from

@Logan.Albrecht

So you are saying you dont know the base path as well?

Manually how do you decide which files you need? Is there any specific naming convwntion? If yes then we can use filters accordingly

Cheers