Is there a REST way to get all the documents with its properties under a specific folder into a document library ?

I'm doing it like so:

var url = _spPageContextInfo.siteAbsoluteUrl + "/_api/lists/getbytitle('Documents')/items?$select=FileRef,ServerRedirectedEmbedUrl,Title,URL,File&$expand=File";

But it gives me all documents in the lib, I tried filtering fileRef but it doesn´t worked.

So I look for a better way to accomplish that.



1 Answer 1


You can use following REST query to retrieve the files in a folder.

var url = _spPageContextInfo.webAbsoluteUrl + "_api/web/getfolderbyserverrelativeurl('<<folder path>>')/Files"

Here folder path is your folder relative path.



To include subfolders and files use the following syntax

var url = _spPageContextInfo.webAbsoluteUrl + "_api/web/getfolderbyserverrelativeurl('<<folder path>>')?$expand=Folders,Files"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.