Skip to main content

Each

Legacy Documentation
You're viewing legacy documentation for API Fortress (deployed via an on-premises container). To view documentation for the new SaaS version of API Fortress now known as Sauce Labs API Testing and Monitoring (with Sauce Connect tunnels) see API Testing on the Sauce Labs Cloud.

Allows you to iterate over a collection of elements and execute the piece of code for each element.

Parameters

NameType/ValueRequired
ExpressionExpressionYes

Expression: The path of the collection you want to iterate on.

note

See the Expression page for more details.

Examples

1each.jpg

for each 'legs' collection checks if 'vector' item is an integer value.

If a collection is nested in another one, you need to refer to them as _1, _2, and so on.

nestedEach.jpg

for each payload.content.flights collection checks if 'price.amount' is an integer and then, for each legs array (that is a nested collection in the flights collection) checks if vector item is an integer value.