Graph API $select nested properties

Graph API $select nested properties
1

Upvotes

Upvote

 Jan 26 2024
1 Comments (1 New)
New
It would be nice if the Graph API could allow developers to specify $select parameters for nested properties. Currently the $select parameters only work for "top-level" properties, but if they worked with nested properties as well, it could further help to limit the amount of data returned and reduce the size of the JSON response. Some of the nested properties can be rather large like the driveItem 'parentReference' property. This is an 'itemReference' resource type and if it is $select 'ed, you end up having to get everything, even if you only cared about retrieving the 'id'.
Something like the following would be ideal:
 
GET /drive/{drive-ID}/items/{item-ID}?$select=id,name,parentReference:id
 
And get back something like this:
 

 

 

 

{
    "id": "023KLJSDG0235823592D",
    "name": "some_file.txt",
    "parentReference": {
          "id": "4964346HDHHGSDG2423423K"
    }
}

 

 

 

Instead of having to do this:

GET /drive/{drive-ID}/items/{item-ID}?$select=id,name,parentReference

 

And getting back something like this:

 

 

{
   "id": "023KLJSDG0235823592D",
   "name": "some_file.txt",
   "parentReference": {
      "driveType": "documentLibrary",
      "driveId": "b!332KNJN2K3689MNJN234NUNk",
      "id": "045DFHDHFJFDMF258JDJN",
      "name": "some_folder",
      "path": "/drives/b!332KNJN2K3689MNJN234NUNk/root:/some_folder",
      "siteId": "2bh566-1234-56k-235kioih-58w53jkdjj"
   }
}

 

 

 

Comments
Copper Contributor

Agreed,

 

Or, nested $select support (which appears to be available in other areas) would be another helpful option.

 

select=remoteItem(select=parentReference(select=id,name,driveId))