# Not able to get response from http request

**URL:** <https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356>\
**Category:** General\
**Created:** [19 December 2019 18:13 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356 "2019-12-19T18:13:03Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![1984](https://avatars.discourse-cdn.com/v4/letter/1/ee59a6/32.png) [@1984](https://discourse.nodered.org/u/1984)\
**Post date:** [19 December 2019 18:13 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/1 "2019-12-19T18:13:03Z")

</div>

Hi,  
this is the first time i use node-red.  
I tried to create a flow with http in and get the response.  
But when i go to : [http://127.0.0.1:1880/trade](http://127.0.0.1:1880/trade)  
i see **Cannot GET /trade**

I would like to see the response in json format

here is the flow:  
u need the replace the token

> [  
> {  
> "id": "4e283e7e.2b78a",  
> "type": "tab",  
> "label": "trade",  
> "disabled": false,  
> "info": ""  
> },  
> {  
> "id": "96fb3786.88f1d8",  
> "type": "http response",  
> "z": "4e283e7e.2b78a",  
> "name": "trade response",  
> "statusCode": "200",  
> "headers": {
> 
> ```
> },
> "x": 500,
> "y": 140,
> "wires": [
>   
> ]
> 
> ```
> 
> },  
> {  
> "id": "e5e06e48.7d2b9",  
> "type": "http in",  
> "z": "4e283e7e.2b78a",  
> "name": "trade request",  
> "url": "[https://api.worldtradingdata.com/api/v1/stock?symbol=TSLA&api\_token=paste-token-here](https://api.worldtradingdata.com/api/v1/stock?symbol=TSLA&api_token=paste-token-here)",  
> "method": "get",  
> "upload": false,  
> "swaggerDoc": "",  
> "x": 210,  
> "y": 140,  
> "wires": [  
> [  
> "28a2346d.a82e3c"  
> ]  
> ]  
> },  
> {  
> "id": "28a2346d.a82e3c",  
> "type": "template",  
> "z": "4e283e7e.2b78a",  
> "name": "Template",  
> "field": "payload",  
> "fieldType": "msg",  
> "format": "handlebars",  
> "syntax": "mustache",  
> "template": "This is the payload: {{payload}} !",  
> "output": "json",  
> "x": 340,  
> "y": 220,  
> "wires": [  
> [  
> "96fb3786.88f1d8"  
> ]  
> ]  
> }  
> ]

---

<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:** [19 December 2019 18:27 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/2 "2019-12-19T18:27:56Z")

</div>

The HTTP In node is used to define the endpoint within Node-RED that responds to HTTP requests.

If you want it to respond to `http://127.0.0.1:1880/trade` then the HTTP In node should be configured with a url of `/trade`.

If you want the flow to then make an HTTP Request to the worldtradingdata api you currently have in the HTTP In node, then you need to add an `HTTP Request` node to the flow and use that to make the request.

The cookbook has lots of examples for using the different HTTP nodes - it may be worth spending a bit of time working through that so you are familiar with the different nodes - [cookbook.nodered.org](http://cookbook.nodered.org)

---

<div class="post-metadata">

**Author:** ![1984](https://avatars.discourse-cdn.com/v4/letter/1/ee59a6/32.png) [@1984](https://discourse.nodered.org/u/1984)\
**Post date:** [19 December 2019 19:36 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/3 "2019-12-19T19:36:34Z")

</div>

Hi,  
thank you for your answer.  
i did check at first the cookbook and i found **Simple Get request** example.  
But i'm trying to get response from api service.  
If i paste the url directly in google chrome then i get the response in json format.  
I wanted to do the same with node-red because later i want to extract some data from the json.  
So i tried your second suggestion and i get nothing, HTTP Request (url=https://api.worldtradingdata.com/api/v1/stock?symbol=TSLA&api\_token=)  
Then i added a second HTTP Request but i suppose it's HTTP Response, i tried both  
Cannot GET /trade here trade is the name of the Flow right?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 December 2019 12:06 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/4 "2019-12-20T12:06:32Z")

</div>

Does your flow look like this?

```auto
trigger (start the process)
  -> http-request (with the api URL to get the data from the web api)
    -> debug (to show the data returned from the api)

```

If not, try with that first.

---

<div class="post-metadata">

**Author:** ![1984](https://avatars.discourse-cdn.com/v4/letter/1/ee59a6/32.png) [@1984](https://discourse.nodered.org/u/1984)\
**Post date:** [20 December 2019 16:40 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/5 "2019-12-20T16:40:17Z")

</div>

Yes my flow is like you desribed.  
But still i don't get any response.  
i expect to see the response in json format.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 December 2019 16:46 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/6 "2019-12-20T16:46:07Z")

</div>

Unfortunately, I don't have an API key for that site so I can't test it. Try just outputting plain text from the http-request in case something odd is happening with the parsing.

---

<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:** [20 December 2019 16:48 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/7 "2019-12-20T16:48:47Z")

</div>

Can you share the flow you have tried so we can see for certain what you are now trying?

---

<div class="post-metadata">

**Author:** ![1984](https://avatars.discourse-cdn.com/v4/letter/1/ee59a6/32.png) [@1984](https://discourse.nodered.org/u/1984)\
**Post date:** [21 December 2019 04:34 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/8 "2019-12-21T04:34:44Z")

</div>

just go there [https://www.worldtradingdata.com/](https://www.worldtradingdata.com/) and register then u get api key.  
it s free.

---

<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:** [21 December 2019 07:24 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/9 "2019-12-21T07:24:28Z")

</div>

You need to use the http-request node, not the http-in/response nodes.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [21 December 2019 08:55 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/10 "2019-12-21T08:55:18Z")

</div>

Works fine for me using http-request as @bakman2 suggested.

 ![ScreenShot046](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/11dbb39b7b1d182971a45a619db522ba57b21f2b.png)

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

---

<div class="post-metadata">

**Author:** ![1984](https://avatars.discourse-cdn.com/v4/letter/1/ee59a6/32.png) [@1984](https://discourse.nodered.org/u/1984)\
**Post date:** [22 December 2019 03:07 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/11 "2019-12-22T03:07:03Z")

</div>

Yes it works now.  
i used the inject node and i forgot to click on the button of inject node.  
Thank you very much to all of you.  
we can close this thread.

---

<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:** [5 November 2020 14:03 UTC](https://discourse.nodered.org/t/not-able-to-get-response-from-http-request/19356/12 "2020-11-05T14:03:38Z")

</div>

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