# Solved Question on how to store api data to test function

**URL:** https://discourse.nodered.org/t/solved-question-on-how-to-store-api-data-to-test-function/94755
**Category:** General
**Created:** [20 January 2025 11:00 UTC](https://discourse.nodered.org/t/solved-question-on-how-to-store-api-data-to-test-function/94755 "2025-01-20T11:00:39Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![old-grumpy](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@old-grumpy](https://discourse.nodered.org/u/old-grumpy)
#### Post date: [20 January 2025 11:00 UTC](https://discourse.nodered.org/t/solved-question-on-how-to-store-api-data-to-test-function/94755/1 "2025-01-20T11:00:39Z")

</div>

I need to chance the function node code as my old service is now subscription. now going use " [https://weerlive.nl/api/weerlive\_api\_v2.php?key=demo&locatie=Amsterdam](https://weerlive.nl/api/weerlive_api_v2.php?key=demo&locatie=Amsterdam)" wget get that,no problem. I like to store this data so i can reuse it to test my code and not spam that server.  
What is the best way to do that ?

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [20 January 2025 11:10 UTC](https://discourse.nodered.org/t/solved-question-on-how-to-store-api-data-to-test-function/94755/2 "2025-01-20T11:10:44Z")

</div>

You can visit that URL in your browser - this is Firefox:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/7/d75b782f414f33c2444dc37e48d71135f5f9bc3c.png)

Use the Copy option at the top and paste into a Node-red template.  
Make sure the output type is Parsed JSON

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/5/e5f73f51618cc2247df6e714cbe1b0d60796b1df.png)

Now you can use an inject node to trigger the template  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/4032090b32d487762ec691f89121ab2fb00ac19a.png)

---

<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: [20 January 2025 12:01 UTC](https://discourse.nodered.org/t/solved-question-on-how-to-store-api-data-to-test-function/94755/3 "2025-01-20T12:01:21Z")

</div>

You can also use a http request node to grab the data, then use a debug node to view/copy the data. This data can then be saved in a inject node using the JSON type input. Or you can save the data to a context variable for later access in your test flows.

There’s a great page in the docs ([Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)) that will explain how to use the debug panel to find the right path/value for any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

---

<div class="post-metadata">

### Author: ![old-grumpy](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@old-grumpy](https://discourse.nodered.org/u/old-grumpy)
#### Post date: [20 January 2025 12:23 UTC](https://discourse.nodered.org/t/solved-question-on-how-to-store-api-data-to-test-function/94755/4 "2025-01-20T12:23:27Z")

</div>

Thanks will try the injection node. Because was going to try dashboard 2 and need a other guide how to use template 2 first 🙂  
Or i go back to dashboard,that worked for me.

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [20 January 2025 14:06 UTC](https://discourse.nodered.org/t/solved-question-on-how-to-store-api-data-to-test-function/94755/5 "2025-01-20T14:06:46Z")

</div>

1. I did not suggest a _dashboard_ template, for either v1 or v2.
2. The copy from debug will work as long as msg.payload is not too large. Anything beyond 1000 characters (?) is not shown by debug.

---

<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: [20 April 2025 14:07 UTC](https://discourse.nodered.org/t/solved-question-on-how-to-store-api-data-to-test-function/94755/6 "2025-04-20T14:07:38Z")

</div>

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