I'm trying to find a REST API query which shows all HTML, CSS, js ect. all type of pages and documents. I'm trying to get exact same results as SharePoint default search.
2 Answers
Try the following query url, this will give you all the records associated with document content type.
https://yourtenant.sharepoint.com/_api/search/query?querytemplate='IsDocument:true'
You can also query something like below, where you are trying to find document with specific term
https://yourtenant.sharepoint.com/_api/search/query?querytext='search_data'&querytemplate='{searchterms} IsDocument:true'
By default SP REST API display 10 records. Add row limits to query to include as many result items you desire.
You can also follow MSDN documentation to learn more on SP Search.
You can use below REST API
To get all Documents/ Pages from site :
/_api/search/query?querytext='IsDocument:True'
To get specific pages/files like CSS,JS,HTML etc :
/_api/search/query?querytext='FileExtension:<extension>'
Example:
/_api/search/query?querytext='FileExtension:html'