Foreach

type: forEach
step:
  name: "Batch User Processing"
  list: "filter(users, {.status == 'pending'})"
  as: "user"
  body:
    - type: http
      step:
        name: "Process User"
        method: POST
        url: "/users/process"
        body:
          file: "request.json"
          data:
            userId: "user.id"
FieldTypeRequiredDescription
typestringYesMust be "forEach"
namestringYesDescriptive name for the iteration step
listexprYesExpression that evaluates to a list
asstringYesVariable name that stores the current item
bodylist<step>YesSteps to execute for each item in the list

Description
ForEach steps iterate over a dynamically generated list and execute a set of steps for each item in the list. The list field is an expr expression that must evaluate to a list. The as field is a string that defines the variable name used to reference the current item in each iteration.

Warning

The variable defined in as is only available within the same steps.