Retrieve files in child folder when accessing parent folder

How do I fetch all the files under parent folder and child folder too while fetching files from “Files” using GET? It only fetches contents of parent folder only when I fetch GET “/files/parent”. How do I get files under parent and child too?

Hi, Vikram. To fetch all files, including all the files under parent folder, you should set “recursive” true.

https://api.backendless.com/<application-id>/<REST-api-key>/files/<path>?  
                    pattern=<pattern>&  
                    sub=<recursive>&  
                    pagesize=<pagesize>&  
                    offset=<offset>

More info in Documentation.

Regards, Andrii.

1 Like

I read the docs too.I added “&recursive=true” or “&sub=true” in the url but it gets me
{ "code": 6007, "message": "The specified resource was not found", "errorData": {} }
Moreover I am interested in only retrieving the files within in child folder and not child folder itself.
How do I sort files in order of date created?

Can you show full URL that is used for request? Replace your API-key with something like “”. And I’ll try to reproduce the problem.

Regards, Andrii.

I am using

https://api.backendless.com/aaaaa/bbbb/files/parentdirectory?recursive=true

I fixed it was missing “?” but even after that I get file in parent directory and child directory as file not the files under child directory

You should change “recursive” to “sub” and set “pattern” parameter. Try this:
https://api.backendless.com/<APP-ID>/<API-key>/files/parent_path?pattern=*&recursive=true

Thanks Its working now.I thought it can work without pattern.

Any way to retrieve it in sorted by date order?

You’re welcome!

What about sorting: there is no possibility to get files sorted by custom parameter, you should do it on your side.

Regards, Andrii.

1 Like