# How to implement the REST API

**URL:** <https://discourse.nodered.org/t/how-to-implement-the-rest-api/16197>\
**Category:** General\
**Created:** [2 October 2019 11:30 UTC](https://discourse.nodered.org/t/how-to-implement-the-rest-api/16197 "2019-10-02T11:30:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aargollo](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@aargollo](https://discourse.nodered.org/u/aargollo)\
**Post date:** [2 October 2019 11:30 UTC](https://discourse.nodered.org/t/how-to-implement-the-rest-api/16197/1 "2019-10-02T11:30:26Z")

</div>

Hi Guys,  
I'm working to build a Zigbee Gateway using the node-red and Rpi3.  
I have all those basic nodes done. I have storaged important parameters in the file and memory, and function commands defined.  
At this moment I need to implement a REST API that can be hanlding all those things, DB files (JSON) , memory and command in the functions.

Someone can share w/ me the best way to implement a good REST API to my project?  
If possible, please, share part of the code an articles necessary to my studies about how to implement it?

Best Regards,  
Alex

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [2 October 2019 11:33 UTC](https://discourse.nodered.org/t/how-to-implement-the-rest-api/16197/2 "2019-10-02T11:33:51Z")

</div>

Similar to this?

> **[node-red-contrib-zigbee](https://flows.nodered.org/node/node-red-contrib-zigbee)**
>
> Node-RED Nodes for Zigbee Devices

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 October 2019 12:40 UTC](https://discourse.nodered.org/t/how-to-implement-the-rest-api/16197/3 "2019-10-02T12:40:39Z")

</div>

Do you mean you want node-red to act as a web service providing the API to connected clients?

---

<div class="post-metadata">

**Author:** ![aargollo](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@aargollo](https://discourse.nodered.org/u/aargollo)\
**Post date:** [2 October 2019 13:37 UTC](https://discourse.nodered.org/t/how-to-implement-the-rest-api/16197/4 "2019-10-02T13:37:38Z")

</div>

Hi Colin,  
Yes, I want node-red to act as a web service to providing the API, as the server (node-red) to clients!

Best Regards,  
Alex

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [2 October 2019 13:39 UTC](https://discourse.nodered.org/t/how-to-implement-the-rest-api/16197/5 "2019-10-02T13:39:46Z")

</div>

This might help:  
[https://cookbook.nodered.org/http/serve-json-content](https://cookbook.nodered.org/http/serve-json-content)

If you are only serving locally, should work without issue, serving to the internet is a different story.

Isn't zigbee2mqtt not a better solution ?

---

<div class="post-metadata">

**Author:** ![aargollo](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@aargollo](https://discourse.nodered.org/u/aargollo)\
**Post date:** [2 October 2019 13:50 UTC](https://discourse.nodered.org/t/how-to-implement-the-rest-api/16197/6 "2019-10-02T13:50:55Z")

</div>

Hi Krambriw,  
It´s too similar, but I´m using another SoC, I really like Texas and CC25xx or CC26xx, but I´m using another SoC from NXP call JN5168. When I using it I got a higher power to implement any integration w/ another end-devices available on the market.

Best Regards,  
Alex
