REST get all subfolder and files in one call, limiting the fields returned and sort by folder or file name.
I currently have a URL at:
https://domain.sharepoint.com/sites/subsite/_api/Web/GetFolderByServerRelativeUrl('/sites/subsite/Shared%20Documents/subfolder')?$expand=Files,Folders/Files,Folders/Folders/Files,Folders/Folders/Folders/Files,Folders/Folders/Folders/Folders/Files,Folders/Folders/Folders/Folders/Folders/Files,Folders/Folders/Folders/Folders/Folders/Folders/Files&$select=Name,Files,Folders,ServerRelativeUrl&$orderby=Name&$select=Name
which returns all 500 subfolders with their 2,000 files. The problem is that this response is 20 megabytes and includes all the columns of data for each file and folder. They are also not in alphabetical order within a folder.
I've tried using the $orderby and $select, but these have no impact on the resonse. Is there a way to limit the fields of data returned to just the name and to have the results within a folder to be sorted alphabetically?
I'm using JavaScript to parse the JSON into a file tree structure and this works fine. The problem is that it takes 20 seconds to receive such a large response (most of the data columns are useless for me) and results are not ordered alphabetically. I could order the results using JavaScript, but if there is a handy way to do this in the REST call, then even better. Thanks!