Can we pass-in URL parameters to a dashboard?


I have embedded several node-red dashboards via iframe - that works as expected.

The surrounding page now needs to pass also an ID to the iframe/dashboard or better to the flow driving the dashboard. In the flow, I will then use it to retrieve further data via REST-calls.

But how can I access the extra URL parameter that is passed in from the surrounding page?

Thanks in advance

Have you tried adding query parameter to the URL and attaching a debug node (set to show full msg) to your http in node? Pretty sure they're available as properties in the msg object.

I have tried that now but no success. Adding a parameter works, i.e. the dashboard is still shown.

But it seems that a http input node (with the same URL as the dashboard) is not called when the dashboard URL is called from parent page or directly from the browser.
To double check I have also made a test with a REST endpoint with a different URL - this is triggered then.

I understand that because adding an httpin node with the same URL as the dashboard would otherwise mean that this endpoint is triggering two things a) deliver the dashboard and b) get handled by the flow. That cannot work because only handler gets the request and can send a response.

Have also checked if UICONTROL node will help, but does only deliver connect/disconnect.

However, found a workaround:

  • define an extra REST endpoint
  • extract the URL params there
  • then return the dashboard URL within an extra iframe

Will do it for me, although a bit ugly. Then cleanest way would be to let UICONTROL pass extra URL params as well.

Thanks Steve!

not quite understanding what you are trying to do yet ... ui_control provides more than just connect and disconnect, it also reports tab changes, etc - and the session they came from. going the other way you can use it to show and hide groups and jump to different tabs. What info are you trying to pass ? what is the end goal ?

Hi dceejay,

with node-red Dashboard I create chart graphics. I embed these graphics in another page, i.e. Dashboard pages are loaded via iframe.

Now I need to pass a certain database ID to the Dashboard page. I expect to be able to retrieve this ID in the node-red flow driving the Dashboard page. This will allow me to use the ID and load some specific data (REST call to a 3rd system), that will then also be shown on the Dashboard page. There is no other way to handle that in my scenario.

so what would a potential url look like ?

like this

e.g. for the dashboard tab 0 and to pass param1 to it

So I could perhaps add them to the ui-control "change" message as a params object ? like
I can't help feeling that causing the page to reload can't be the most efficient way to do this.

This would be a great idea, I have the same need. I would like to be able to directly call the dashboard url and pass query parameters in the url...

And did you try it... ???
you may find it works already :slight_smile:

I had tried it, but after your post, I updated my dashboard and tested again, it works ! Thanks a lot !

1 Like