Files API - Get List of all files in Folder

SOLVE
onvista
Contributor

Hey community,

 

just found the new Files Api and checked the endpoints, but couldn't find an endpoint to get a simple list of all files in a specific folder.

 

Something simple like:

GET /files/v3/folders/{folderId}/files

 

Use case:
As a User, I want to see all available files in a folder, So I can click on a file to view it.

 

Can anyone help me out to the the list of files?

0 Upvotes
1 Accepted solution

Accepted Solutions
JBeatty
Solution
Top Contributor | Platinum Partner

Hi @onvista,

 

You can do this by using the GET/files/v3/files/search endpoint. If you have the folder ID you can preform a get request like:

https://api.hubapi.com/files/v3/files/search?parentFolderId={Your-Folder-ID-Here}&hapikey={Your-hapikey-Here}

Or if you know the path you can do:

https://api.hubapi.com/files/v3/files/search?path={Your-Path-Here}&hapikey={Your-hapikey-Here}

And for reference an example path could look like this(without the quotes): 

"/folder-one/Folder%20Two/"

Notice the %20 URL encoding of a space, and how the path starts and ends with a "/".

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

View solution in original post

2 Replies 2
JBeatty
Solution
Top Contributor | Platinum Partner

Hi @onvista,

 

You can do this by using the GET/files/v3/files/search endpoint. If you have the folder ID you can preform a get request like:

https://api.hubapi.com/files/v3/files/search?parentFolderId={Your-Folder-ID-Here}&hapikey={Your-hapikey-Here}

Or if you know the path you can do:

https://api.hubapi.com/files/v3/files/search?path={Your-Path-Here}&hapikey={Your-hapikey-Here}

And for reference an example path could look like this(without the quotes): 

"/folder-one/Folder%20Two/"

Notice the %20 URL encoding of a space, and how the path starts and ends with a "/".

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

View solution in original post

webdew
Top Contributor | Diamond Partner

Hi @onvista ,

Please follow the below link for files:
Screen shot : https://prnt.sc/1eagrx6
Links : https://legacydocs.hubspot.com/docs/methods/files/get_files_file_id

Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 

0 Upvotes