Basically, I have something like this:
https://company.crm.dynamics.com/api/data/v9.0/accounts?$select=accountid,accountnumber,name&$expand=crm_productbuyer($select=name)
I'd like to be able to just get a count of the number of records returned in the $expand
instead of deserializing it in C# and doing a count on it. Just one lest thing to iterate over.
This didn't work for my case:
EDIT:
There are a number of things here that indicate this isn't doable:
You can’t use the /$ref or /$count path segments to return only the URI for the related entity or a count of the number of related entities.
This is a subset of the system query options described in the “11.2.4.2.1 Expand Options” section of OData Version 4.0 Part 1: Protocol Plus Errata 02. The options $skip, $count, $search, $expand and $levels aren’t supported for the Web API.
Will mark this an answer unless someone else chimes in to demonstrate otherwise.