HarmonyCore icon indicating copy to clipboard operation
HarmonyCore copied to clipboard

$count only working on main collection endpoint

Open SteveIves opened this issue 6 years ago • 0 comments

Currently, $count is only working on main collection endpoints, for example:

https://localhost:8086/odata/v1/Customers/$count

According to the OData 4 spec, it should be possible to append /$count to any URL that returns a collection, for example, any non-unique primary key endpoints:

https://localhost:8086/odata/v1/Customers(State='WA')/$count

It should also be possible to apply filter criteria on the $count to return the count of entities matching filter criteria:

https://localhost:8086/odata/v1/Customers/$count($filter=State eq 'WA')

It should also be possible to use $count within a relation expansion that returns a collection, to determine the number of matching related entities:

https://localhost:8086/odata/v1/Customers?$expand=REL_Orders($count=true)

There are additional use cases, but some are based on conventions for expanding relations that we do not currently support. For example:

https://localhost:8086/odata/v1/Customers(1)/Orders/$count

More info: http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_AddressingtheCountofaCollection

Aha! Link: https://synergex.aha.io/features/HC-88

SteveIves avatar Oct 16 '18 06:10 SteveIves