4.2.7 Retrieve the Count of a Collection of Entities

The following example illustrates the exchange of messages required for a client to retrieve a count of all Customer entities. This example is supported only in the OData 2.0 and OData 3.0 protocols.

Request:

 GET /service.svc/Customers/$count HTTP/1.1
 Host: host
 Accept: text/plain
 DataServiceVersion: 2.0
 MaxDataServiceVersion: 2.0
 Content-Type: text/plain

Response:

 HTTP/1.1 200 OK
 Content-Type: text/plain
 DataServiceVersion: 2.0;
 Date: Fri, 01 May 2009 21:41:31 GMT
 Content-Length: 2
  
 91