Count

Returns a count of the number of items available.

In the following example, we will use Addons to return a count of items. It will use the same example data from List of items and Single items. The example will use an Addon to extend the merchant records with a count of the deals available with each record.

First, within the Query all Records function we will create and Addon. Then, we will choose the deal table to add to the response.

Next, we will choose how we want the data returned. For this example, we will return the data by item count.

Then, we choose the field in the deal database table to map to the merchant table.

The last steps are to give the Addon a name, confirm the mapped field and optionally customize the response. However, since this Addon is returning a count, we actually don't have anything to optionally customize for the Addon response.

Once those steps are complete, we will see a preview of how the response of the Query all Records for the merchant table will be extended.

Finally, once we run this API endpoint, we can see the Addon is returning a count of deals associated with the merchant record.

Last updated