Team , I need to get the lookup count through web api.
For ex : we have a case entity.In case entity owner A having 20 cases and Owner B having 30 cases.
Now I need to get the count of cases based on the owner lookup.
expected Json
"value":[{"owner":Owner A,"COUNT":20},{"owner":Owner B,"COUNT":30}]
If I try this for getting the status(optionset) count by using /api/data/v9.1/incidents?$apply=groupby((statuscode),aggregate($count%20as%20COUNT)).It will return the count.
"value":[{"statuscode":19090909,"COUNT":45},{"statuscode":2121232,"COUNT":8}]