There are probably several different ways to do this and I'm still a bit unsure what your app looks like. Here are a couple options that I've used in the past.
You could use a js query, which upon trigger
builds the array locally (query local scope) from various components within your app and triggers another query (the rest query) using additionalScope
builds the array and stores it in temporary state (global in your app until the app is reset) for later use when triggering the rest query