Use a for-range loop to make HTTP requests

Uses range-based iteration to make HTTP requests.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

YAML

- init:
    assign:
      - minTemp: -14.5
      - maxTemp: 42.8
- storeNormalBodyTemp:
    for:
      value: temp
      range: ${[minTemp, maxTemp]}
      steps:
        - checkTemp:
            call: http.get
            args:
              url: ${"https://example.com/isBodyTempNormal?temp=" + string(temp)}
            result: isNormal
        - storeOrBreak:
            switch:
              - condition: ${isNormal}
                next: storeTemp
            next: break
        - storeTemp:
            call: http.post
            args:
              url: ${"https://example.com/storeTemp?temp=" + string(temp)}
              body: ${temp}

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.