0

I am trying to fetch only the site pages and not the page templates using REST call, but using below REST endpoint I am getting all the site pages including page templates.

How to filter out only the site pages from site pages library so it does not include page templates present in site pages library.

/_api/web/lists/getByTitle('Site Pages')/items?$select= Title,ID&$filter=Title ne null
1

To fetch only Site Pages and exclude page templates, use endpoint like below:

<siteUrl>/_api/Web/Lists/getByTitle('Site Pages')/items?$select=Title,OData__SPSitePageFlags&$filter=OData__SPSitePageFlags ne 'Template'
1

Per my test, for page tempates, the property OData__SPSitePageFlags is not equal null.

So you could add the filter like the below:

$filter=Title ne null and OData__SPSitePageFlags eq null

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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