# Beginner Tip Do HTTP Request from JSON

**URL:** <https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565>\
**Category:** General\
**Created:** [26 November 2020 14:00 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565 "2020-11-26T14:00:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![shwoy](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shwoy](https://discourse.nodered.org/u/shwoy)\
**Post date:** [26 November 2020 14:00 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/1 "2020-11-26T14:00:31Z")

</div>

Hi Guys,

i am rly new to NodeRed. I hope someone can help.

I used an API from NASA and get a json answer on my debugwindow.

msg.payload : Object

object

date: "1997-01-28"

explanation: "Many stars form in clusters. Two types of star clusters are visible in our Milky Way Galaxy: open clusters and globular clusters. Open clusters like M50, shown above, typically contain hundreds of..."

hdurl: "[https://apod.nasa.gov/apod/image/9701/m50\_kc\_big.jpg](https://apod.nasa.gov/apod/image/9701/m50_kc_big.jpg)"

media\_type: "image"

service\_version: "v1"

title: "Open Cluster M50↵Credit and Copyright:"

url: "[https://apod.nasa.gov/apod/image/9701/m50\_kc.jpg](https://apod.nasa.gov/apod/image/9701/m50_kc.jpg)"

So my question is now: "How can i tell nodered that it should open the picture the upper url? "

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 November 2020 15:29 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/2 "2020-11-26T15:29:03Z")

</div>

> [@shwoy](#):
>
> How can i tell nodered that it should open the picture the upper url

What do you mean? Have node-red open the image in an image viewer on the same pc as node-red is running or on a client pc? Download the image to file? Present the image on a dashboard???

---

<div class="post-metadata">

**Author:** ![shwoy](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shwoy](https://discourse.nodered.org/u/shwoy)\
**Post date:** [26 November 2020 15:56 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/3 "2020-11-26T15:56:28Z")

</div>

Hi Steve

NodeRed runs on a client PC. On Dashboard would be nice. I think i have to use a functionblock but i struggle with the code that i need to write in it.  
Perfect would that when i deploy and run NR it give me the jsontext in the debugwindow and opens a new tab with the picture. Is it not possilble it would cool to see the picture via dashboard.

I want to see the Picture without copy the link from json in new tab. It should be done automaticly. I also dont want to download the pic.

ty

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 November 2020 16:00 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/4 "2020-11-26T16:00:48Z")

</div>

If you just wanna see the image you could....

http-request --\> image node --\> image viewer

see [this](https://flows.nodered.org/node/node-red-contrib-image-tools) - look at the `Get image from internet` demo. To import the built in example use CTRL+I --\> examples.

copy the path to the image by using the copy path button & use that to get the image.

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

> **[Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)**

---

<div class="post-metadata">

**Author:** ![shwoy](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shwoy](https://discourse.nodered.org/u/shwoy)\
**Post date:** [26 November 2020 19:36 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/5 "2020-11-26T19:36:40Z")

</div>

Hi Steve  
unfortunately i dont have access to the Image nodes....  
My flow is now inject-\> http request with api -\> json -\> debug  
One way could be the json node. With this node i can use the single item in the json.

So i need a new http request but how do i bring my url from the first json into it?....

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 November 2020 19:52 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/6 "2020-11-26T19:52:47Z")

</div>

> [@shwoy](#):
>
> unfortunately i dont have access to the Image nodes

Why not? You can install it from manage pallete  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/9/692e78470b88641ad5b736bc22f7813a558bb845.png)

> [@shwoy](#):
>
> With this node i can use the single item in the json.
> 
> So i need a new http request but how do i bring my url from the first json into it?....

put a change node after the JSON node and copy the JSON value to `msg.url` then feed that to a 2nd http request. The built in help tells you this...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0fcece27b396d8b0c908fb74e9085a06dd35aac7.png)

---

<div class="post-metadata">

**Author:** ![shwoy](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shwoy](https://discourse.nodered.org/u/shwoy)\
**Post date:** [27 November 2020 11:36 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/7 "2020-11-27T11:36:14Z")

</div>

Hi steve

sorry i dont get it. I can't install new nodes because i dont have install rights. Im using NR via institution.

So i have this flow now:  
Timstamp-\> httprequest-\> json-\> payload  
-\> change -\> payload

i get this output form the upper payload  
object  
title: xxx  
title2: yyy  
tittle3:url

the url is title 3. What must i do in change node to get only title 3 and open this

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [27 November 2020 11:58 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/8 "2020-11-27T11:58:24Z")

</div>

> [@shwoy](#):
>
> What must i do in change node to get only title 3 and open this

Read the link i posted before

> [@Steve-Mcl](#):
>
> ### [Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)

once you have the path to the URL, use a change node to set to copy the value from the path of that url into `msg.url` then pass that to another http request

---

<div class="post-metadata">

**Author:** ![shwoy](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shwoy](https://discourse.nodered.org/u/shwoy)\
**Post date:** [27 November 2020 13:11 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/9 "2020-11-27T13:11:50Z")

</div>

ok i think i took a step forward. So i used a function node to seperate the url. When i deploy an run then NR tell me only the right URL.

So now i have to use the http request. Funktion go in and payload go out? But what do i need to set in the requust node?

---

<div class="post-metadata">

**Author:** ![shwoy](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shwoy](https://discourse.nodered.org/u/shwoy)\
**Post date:** [27 November 2020 13:13 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/10 "2020-11-27T13:13:11Z")

</div>

the http request should take the url automaticly and open it

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [27 November 2020 13:47 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/11 "2020-11-27T13:47:40Z")

</div>

> [@shwoy](#):
>
> But what do i need to set in the requust node?

Nothing.

> [@Steve-Mcl](#):
>
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0fcece27b396d8b0c908fb74e9085a06dd35aac7.png)

Just send the `msg` with `msg.url` set to the URL

---

<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:** [26 January 2021 13:47 UTC](https://discourse.nodered.org/t/beginner-tip-do-http-request-from-json/36565/12 "2021-01-26T13:47:42Z")

</div>

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