I have a search query web part that I am running that looks like the following.

(path:"PATH TO FOLDER" AND ContentTypeId:0x0120D520*)

This path contains links to document sets. I am trying to recreate this query in a REST call.

I've tried variations of things like the url below with no luck.

/_api/web/GetFolderByServerRelativeUrl('Path to folder')/Files?$filter=startswith(ContentTypeId,'0x0120D520')
  • Are you not getting any results from the rest url or search query? This url works fine api/web/GetFolderByServerRelativeUrl('Shared%20Documents')/Files?$select=name&$filter=startswith(Name, 'test') Commented Apr 10, 2017 at 20:09
  • @S Merchant The folder structure is Folder > Folder > Documents sets. One top level folder on the subsite and then an inner folder which contains the document sets. I am getting a "Value does not fall within the expected range." error
    – dbrown
    Commented Apr 10, 2017 at 20:13

1 Answer 1


I think you have to use the /_api/web/lists/getbytitle('Documents')/items nomenclature in order to filter by ContentTypeId.

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.