# How to get quantity number of my entries

**URL:** <https://discourse.getcockpit.com/t/how-to-get-quantity-number-of-my-entries/1361>\
**Category:** Uncategorized\
**Created:** [April 15, 2020, 9:38pm UTC](https://discourse.getcockpit.com/t/how-to-get-quantity-number-of-my-entries/1361 "2020-04-15T21:38:16Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [April 16, 2020, 12:14pm UTC](https://discourse.getcockpit.com/t/how-to-get-quantity-number-of-my-entries/1361/3 "2020-04-16T12:14:16Z")

</div>

If you send a request to `example.com/api/collections/get/elements?token=xxtokenxx`, the response should look like this:

```json
{
"fields": {...},
"entries": [...],
"total": 5
}

```

The `total` is your count.

If you want a smaller size of the response, use the fields filter, so the entries object only contains the `_id`.

If you want a rest api endpoint, that only counts, you have to create your own:

`/config/api/collections/count/elements.php`:

```php
<?php
// check filters
$options = [];
return ['total' => cockpit('collections')->count('elements', $options)];

```

Have a look at the RestApi controller to see how the core filtering works:

> <https://github.com/agentejo/cockpit/blob/next/modules/Collections/Controller/RestApi.php#L19>

---

_[View the full topic](https://discourse.getcockpit.com/t/how-to-get-quantity-number-of-my-entries/1361)._
