POST

Count Data Items


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Counts the number of items in the specified data collection that match the filtering preferences.

Endpoint
POST
{DEPLOYMENT-URI}/v3/items/count
Body Params
collectionIdstringRequired

ID of the collection to query.


filterstructRequired

Filter to specify which items to count. See API Query Language for more information about handling data queries.


consistentReadbooleanRequired

Whether to retrieve data from the primary database instance. This decreases performance but ensures data retrieved is up-to-date even immediately after an update. Applicable if the external database is eventually consistent.

Response Object
totalCountinteger

Number of items that match the query.

Request
cURL
curl POST https://external-db.example.com/v3/items/count \ -H 'Content-Type: application/json;charset=UTF-8' \ -H 'Authorization: <AUTH>' \ --d '{ "collectionId": "cities", "filter": { "country": "US" }, "consistentRead": false }'
Response
JSON
{ "totalCount": 42 }
Did this help?