Post an array of collections in a HTTP request

I am querying a REST API that returns an array of objects. This array I’d like to forward to a second HTTP Request. However, when setting up the “request content” in the HTTP module using the array from the previous GET request, the follwing POST request contains this (in “transactions”):

{"receipt_id": 220224_261, "amount": 17.18, "date": "2022-02-24T16:52:56", "transactions": [Collection], [Collection], [Collection], [Collection]}

I have tried all toArray(), toCollection(), whatnot without avail. Any ideas?

Use map() and get() to get what you need from the Collection object.

1 Like

since your transactions is a list of objects, I’m thinking you want to:

map(transactions;*thing-you-want*;*thing-you-filter-for*;*value-to-filter-for*)

ex: map( transactions; email; id; 1234 )

Would return a list of emails from transactions where the id is 1234, which we expect to have one item in it.

Then you need to use the get function to ‘get’ the only item from the list.

Hopefully, you can filter using some unique property so your list won’t ever have more than 1 item.

get( *map(transactions; email; id; 1234)* ; 1)

1 Like