# How to get data from API?

**URL:** https://discourse.nodered.org/t/how-to-get-data-from-api/87421
**Category:** General
**Created:** [22 April 2024 20:29 UTC](https://discourse.nodered.org/t/how-to-get-data-from-api/87421 "2024-04-22T20:29:17Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Garrian](https://avatars.discourse-cdn.com/v4/letter/g/7ea924/32.png) [@Garrian](https://discourse.nodered.org/u/Garrian)
#### Post date: [22 April 2024 20:29 UTC](https://discourse.nodered.org/t/how-to-get-data-from-api/87421/1 "2024-04-22T20:29:17Z")

</div>

Hi there, I want to get data from my Homey, via API.

I have made the flow below, according to this guide:

> **[Getting started with API Keys](https://support.homey.app/hc/en-us/articles/8178797067292-Getting-started-with-API-Keys)**
>
> Homey Pro (Early 2023) offers a feature called API Keys, that's intended for hobbyists and developers to create integrations with their Homey Pro.
> 1. Creating the API Key
> To create an API Key, navi...

But as you see in the debug, i only get the homey verson and ID. What am I doing wrong?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/2/a23da7f3c4855e3f98181631fec0fc271676dc7e.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/2/c2fffb51a3def80576225c609999aaa5667dfdbd.png)

---

<div class="post-metadata">

### Author: ![kitori](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kitori](https://discourse.nodered.org/u/kitori)
#### Post date: [23 April 2024 05:23 UTC](https://discourse.nodered.org/t/how-to-get-data-from-api/87421/2 "2024-04-23T05:23:33Z")

</div>

Maybe try to set the header like this:

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/6/b6d6d33459aac2e25183a066de91723293d0bae6.png)

```auto
[{"id":"e3a9f717e0dbab8a","type":"http request","z":"94c514c2ac360b08","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://127.0.0.1:1880","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Authorization","keyValue":"","valueType":"msg","valueValue":"token"}],"x":650,"y":640,"wires":[["5e3560e9ef6ea6de"]]},{"id":"845b669fc551b684","type":"inject","z":"94c514c2ac360b08","name":"token from msg","props":[{"p":"token","v":"Bearer <your api key>","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":460,"y":640,"wires":[["e3a9f717e0dbab8a"]]},{"id":"5e3560e9ef6ea6de","type":"debug","z":"94c514c2ac360b08","name":"debug 17","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":900,"y":640,"wires":[]},{"id":"28ed30cd1ae7351e","type":"http request","z":"94c514c2ac360b08","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://127.0.0.1:1880","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Authorization","keyValue":"","valueType":"other","valueValue":"Bearer <your api key>"}],"x":650,"y":760,"wires":[["39d0db7f58423862"]]},{"id":"64f769a1b796fd68","type":"inject","z":"94c514c2ac360b08","name":"token from node","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":460,"y":760,"wires":[["28ed30cd1ae7351e"]]},{"id":"39d0db7f58423862","type":"debug","z":"94c514c2ac360b08","name":"debug 18","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":900,"y":760,"wires":[]},{"id":"e2d9a5f9f8bd91d1","type":"comment","z":"94c514c2ac360b08","name":"or","info":"","x":650,"y":700,"wires":[]}]

```

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [23 April 2024 05:50 UTC](https://discourse.nodered.org/t/how-to-get-data-from-api/87421/3 "2024-04-23T05:50:08Z")

</div>

> [@Garrian](#):
>
> What am I doing wrong?

Nothing apart from not using the different classes with your http request [HomeyAPIV3Local - Homey Web API](https://athombv.github.io/node-homey-api/HomeyAPIV3Local.html).

---

<div class="post-metadata">

### Author: ![Giamma](https://avatars.discourse-cdn.com/v4/letter/g/e47774/32.png) [@Giamma](https://discourse.nodered.org/u/Giamma)
#### Post date: [23 April 2024 08:38 UTC](https://discourse.nodered.org/t/how-to-get-data-from-api/87421/4 "2024-04-23T08:38:14Z")

</div>

192-168-1-116  
??????????????????????

---

<div class="post-metadata">

### Author: ![AndrewBeasley](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@AndrewBeasley](https://discourse.nodered.org/u/AndrewBeasley)
#### Post date: [23 April 2024 21:45 UTC](https://discourse.nodered.org/t/how-to-get-data-from-api/87421/5 "2024-04-23T21:45:39Z")

</div>

Oddly enough that is the way the server can be addressed and is in the example given in the API docs. It's part of a host name and not an IP address!!!

Bit of a frightening address though as it refers to an external domain to access a device internally and who knows what happens if you change the address or two devices have the same one (given lots of home routers default to 192.168.0.0/24 or 192.168.1.0/24 it must happen and be managed somehow).

Just hope it does not use ARP poisoning to determine location!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [22 July 2024 21:46 UTC](https://discourse.nodered.org/t/how-to-get-data-from-api/87421/6 "2024-07-22T21:46:31Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
