# Smart Collection not displaying data

**URL:** <https://community.forestadmin.com/t/smart-collection-not-displaying-data/1559>\
**Category:** Help me!\
**Created:** [January 4, 2021, 6:37am UTC](https://community.forestadmin.com/t/smart-collection-not-displaying-data/1559 "2021-01-04T06:37:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Bissett](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/mike_bissett/32/1289_2.png) [@Mike\_Bissett](https://community.forestadmin.com/u/Mike_Bissett)\
**Post date:** [January 4, 2021, 6:37am UTC](https://community.forestadmin.com/t/smart-collection-not-displaying-data/1559/1 "2021-01-04T06:37:26Z")

</div>

Hi,  
I have created a smart collection, that retrieves some usage report data from an internal rest api but it will not show up in the forest admin ui.

I have created the a forest collection as so:

```javascript
const { collection } = require("forest-express-sequelize");

collection("usage_report", {
  fields: [
    {
      field: "id",
      type: "String",
    },
    {
      field: "sms_current_month",
      type: "Number",
    },
    {
      field: "sms_previous_month",
      type: "Number",
    },
  ],
});

```

And a route as so:

```javascript
const express = require("express");
const router = express.Router();
const { default: Axios } = require("axios");

const {
  RecordSerializer,
  PermissionMiddlewareCreator,
} = require("forest-express-sequelize");

const recordSerializer = new RecordSerializer({ name: "usage_report" });
const permissionMiddlewareCreator = new PermissionMiddlewareCreator(
  "usage_report"
);

router.get(
  "/usage_report",
  permissionMiddlewareCreator.list(),
  async (req, res, next) => {
    let report = {};
    try {
      report = await Axios({
        url: `${process.env.FOREST_ADMIN_API}/report`,
        method: "get",
        headers: {
          "content-type": "application/json",
        },
      });
    } catch (err) {
      next(err);
    }

    console.log(report.data);

    try {
      result = await recordSerializer.serialize(report.data);

      console.log(JSON.stringify(result, null, 4));

      res.send();
    } catch (err) {
      next(err);
    }
  }
);

module.exports = router;

```

When selecting Usage Report in the ui the following logs are generated:

```javascript
forestadmin_1 | server-0 | [
forestadmin_1 | server-0 | {
forestadmin_1 | server-0 | id: 'de345a4f-dbc0-413a-8650-1277a3d4637a',
forestadmin_1 | server-0 | sms_current_month: 0,
forestadmin_1 | server-0 | sms_previous_month: 13,
forestadmin_1 | server-0 | sms_two_months_ago: 5,
forestadmin_1 | server-0 | mms_current_month: 0,
forestadmin_1 | server-0 | mms_previous_month: 6,
forestadmin_1 | server-0 | mms_two_months_ago: 0
forestadmin_1 | server-0 | }
forestadmin_1 | server-0 | ]
forestadmin_1 | server-0 | {
forestadmin_1 | server-0 | "data": [
forestadmin_1 | server-0 | {
forestadmin_1 | server-0 | "type": "usage_report",
forestadmin_1 | server-0 | "id": "de345a4f-dbc0-413a-8650-1277a3d4637a",
forestadmin_1 | server-0 | "attributes": {
forestadmin_1 | server-0 | "id": "de345a4f-dbc0-413a-8650-1277a3d4637a",
forestadmin_1 | server-0 | "sms_current_month": 0,
forestadmin_1 | server-0 | "sms_previous_month": 13
forestadmin_1 | server-0 | }
forestadmin_1 | server-0 | }
forestadmin_1 | server-0 | ]
forestadmin_1 | server-0 | }
forestadmin_1 | server-0 | GET /forest/usage_report?fields%5Busage_report%5D=sms_current_month%2Csms_previous_month%2Cid&page%5Bnumber%5D=1&page%5Bsize%5D=15&searchExtended=0&sort=-id&timezone=Australia%2FSydney 200 - - 9.270 ms

```

## Expected behavior

The data from the rest API should be displayed in forest admin

## Actual behavior

The cannot reach data error page is shown

## Context

- Package Version: Latest liana
- Express Version: express@4.17.1
- Sequelize Version: forest-express-sequelize@6.6.3
- Database Dialect: REST
- Project Name: MTMO

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [January 4, 2021, 7:37am UTC](https://community.forestadmin.com/t/smart-collection-not-displaying-data/1559/2 "2021-01-04T07:37:57Z")

</div>

Hi @Mike_Bissett, and welcome to our community

From what I see in your code, you are missing the `res.send` content in your get route code.

Your can also have a look to [this part](https://docs.forestadmin.com/documentation/reference-guide/collections/create-a-smart-collection#implementing-the-get-all-records) of the documentation, but I would say that replacing `res.send();` by `res.send({ ...result });` should fix the issue here.

Let me know if that helps 🙏

---

<div class="post-metadata">

**Author:** ![Mike\_Bissett](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/mike_bissett/32/1289_2.png) [@Mike\_Bissett](https://community.forestadmin.com/u/Mike_Bissett)\
**Post date:** [January 4, 2021, 9:39pm UTC](https://community.forestadmin.com/t/smart-collection-not-displaying-data/1559/3 "2021-01-04T21:39:40Z")

</div>

Thank you for your response, I cant figure out how I missed something so obvious, because ive already serialized the result i just needed to change my res.send() to res.send(result).
