How to get only Odata.Count without value

Is there a way to get only the amount of data in the response payload without any array of values?

I am using ODataV4.0 with Webapi 2.2. It currently returns all the values โ€‹โ€‹and calculates when I request something like: http://odata/People?$count=true

I just need something like "@odata.count":1, "value":[] or without "value" .

Is this the only way to have a function for this job?

+5
source share
1 answer

Set $ โ€‹โ€‹top to zero and $ count to true.

For example: http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$count=true&$top=0

returns the score, but no results

{"@ odata.context": " http://services.odata.org/V4/Northwind/Northwind.svc/ $ metadata # Clients", "@ odata.count": 91, "value": []}

The account is calculated after applying the $ filter, but excluding $ top and $ skip.

For example: http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$count=true&$top=0&$filter=Country%20eq%20%27Germany%27

reports that there are 11 results in which the Country is โ€œGermanyโ€ but does not return any records in response.

+15
source

All Articles