Solved Question on how to store api data to test function

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" 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 ?

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

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

Now you can use an inject node to trigger the template
image

1 Like

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) 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

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

  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.