How to get only Odata.Count without value

前端 未结 2 1828
梦毁少年i
梦毁少年i 2021-02-19 03:13

Is there any way I can get only count of the data in response payload without any value array?

I am using ODataV4.0 with Webapi 2.2. Currently it returns all the value

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-19 03:38

    You can also append $count as a path element to just get a raw count, E.G.,

    https://services.odata.org/V4/Northwind/Northwind.svc/Customers/$count

    This will also work with filters, etc, applied: https://services.odata.org/V4/Northwind/Northwind.svc/Customers/$count?$filter=Country%20eq%20%27Germany%27

    For a count of Customers in Germany.

提交回复
热议问题