# RED.httpAdmin.get not refreshing JSON

**URL:** <https://discourse.nodered.org/t/red-httpadmin-get-not-refreshing-json/7113>\
**Category:** Developing Nodes\
**Created:** [21 January 2019 20:19 UTC](https://discourse.nodered.org/t/red-httpadmin-get-not-refreshing-json/7113 "2019-01-21T20:19:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 January 2019 20:37 UTC](https://discourse.nodered.org/t/red-httpadmin-get-not-refreshing-json/7113/2 "2019-01-21T20:37:52Z")

</div>

Hi @germancmartinez - when sharing code on the forum _please_ follow the advice in this post: [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506). I have edited your post to fix the formatting.

You are creating an interval that runs every 10 seconds to update some data. The problem comes that you add a new route handler to `RED.httpAdmin` every time. That is not a good idea. You should separate those things out:

- add _one_ route handler that returns whatever is currently in `data`
- create an interval to update `data` as needed

```auto

var data = {};
RED.httpAdmin.get("/equipments/:id", RED.auth.needsPermission('TimeSeries.read'), function(req,res) {
   res.json(data);
});

node.updateEquipmentList = setInterval( async function () {
    var data={};
    if (typeof node.server !== 'undefined' && node.server && typeof node.server.getEquipmentsModel === 'function'){
      data = await node.server.getEquipmentsModel();
      console.log(JSON.stringify(data));
    }
}, 10000);

```

Finally, make sure you clear the `node.updateEquipmentList` interval in your node's close handler.

---

_[View the full topic](https://discourse.nodered.org/t/red-httpadmin-get-not-refreshing-json/7113)._
