使用 for-range 循环发出 HTTP 请求

使用基于范围的迭代发出 HTTP 请求。

深入探索

如需查看包含此代码示例的详细文档,请参阅以下内容:

代码示例

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}

后续步骤

如需搜索和过滤其他 Google Cloud 产品的代码示例,请参阅Google Cloud 示例浏览器