Iterate through mautic api result

Hey,

I would like to do a simple iteration through the result of a mautic api call. The result of my api call looks like this:

Then I would like to walk with an iterator through those contacts:

However within the next module I’m unable to access the mautic contact id field for each contact to update them:

Can somebody tell me what I need to change to get this scenario run.

Regards,
Andreas

Is your iterator properly iterating a collection? What does the output bundles look like in the iterator?

This is how the output of the iterator looks like. So there are the separate elements, but I cannot find a possibility to access them one by the other.

UPDATE: what looks strange is the total number of bundles: 1. Shouldn’t this be the amount of the inner elements? Do I need to pass any parameter to get the inner elements within the iterator?

Yeah that’s not going to run the modules after the iterator one by one. Do you want to apply toArray() to your collection inside your iterator module?

1 Like

Yeah that’s it! I put the collection into the toArray() function, so the node behind the iterator gets one element by the other from there it was easy to manage all the rest.

And now a recommendation – try watching the video series I created where you can learn this array function and MANY MANY other useful ones.


Alex Sirota

:heart_on_fire: Check out Make for Make Newbies Video Series :heart_on_fire:

My Solutions on Make Community