Question on Node Red

Solved
lpopejoy
A model citizen

Question on Node Red

I am admittedly new to node red...  just as a warning. 🙂

 

We manage multiple organizations. I have the output of GetOrganizations, and am splitting that and running getNetworks. 

I need to collect all the JSON outputs of each getNetworks call and join them and send it over to a different function that harvests analytics data. 

right now, each network goes to the Analytics function individually. I need it to wait, and then go at the same time...  

 

does that make sense?  Thanks for any advice!!

1 Accepted Solution
Sriram
Meraki Employee
Meraki Employee

Hi Ipopejoy,

I tried to use the function called "Join" to join the outputs of "getnetworks" and get a complete output of single object. I am not sure if this is what you are looking for or if it is different with JSON. FWIW, please find the output of getnetworks, parsed through join below.

Sriram_0-1587610543725.png

 

Worked well with JSON as well.

Sriram_0-1587610975493.png

 

 

View solution in original post

7 Replies 7
Sriram
Meraki Employee
Meraki Employee

Hi Ipopejoy,

how did you manage to retrieve the output of getOrganization and feed it as input to getNetworks?

The getOrganizationetworks has a field msg.organizationId and I am unable to to feed this dynamically. Can you please share how you did this?

lpopejoy
A model citizen

@Sriram Sure:

 

lpopejoy_0-1587559139400.png

The real key is to take output of getOrg and split it (this is only needed if you have multiple organizations), run it into a limiter to not hit API limits, and then run from that into a function.  The function right before "getNetwork" is this:

msg.organizationId=msg.payload.id
return msg;

 This sets the msg.organizationID that getnetworks is looking for from the value that was obtained in the getOrganizations query.

 

Hope that helps!

Sriram
Meraki Employee
Meraki Employee

Thanks a lot Ipopejoy. This was useful and now I was successfully able to retrieve my networks dynamically!. Thanks for your help again.

Sriram_0-1587592437095.png

 

Sriram
Meraki Employee
Meraki Employee

Hi Ipopejoy,

I tried to use the function called "Join" to join the outputs of "getnetworks" and get a complete output of single object. I am not sure if this is what you are looking for or if it is different with JSON. FWIW, please find the output of getnetworks, parsed through join below.

Sriram_0-1587610543725.png

 

Worked well with JSON as well.

Sriram_0-1587610975493.png

 

 

lpopejoy
A model citizen

I tried to use join several ways, and it wouldn’t work for me.

GetOrganizationNetworks returns multiple values for you, right?
Sriram
Meraki Employee
Meraki Employee

That is right. It returns 5 networks.

lpopejoy
A model citizen

Nice, you inspired me to revisit that option, and I found the issue!  🙂

 

In my case, I had an org that was disabled because they had closed the business, and that was causing an error and causing the JOIN node to not work correctly!

Get notified when there are additional replies to this discussion.