For-in 루프에서 HTTP 요청 수행

For-in 루프에서 HTTP 요청을 전송합니다.

더 살펴보기

이 코드 샘플이 포함된 자세한 문서는 다음을 참조하세요.

코드 샘플

YAML

- getUserIDs:
    call: http.get
    args:
      url: https://example.com/getUserIDs
    result: userIds
- saveUserInfo:
    for:
      value: uid
      in: ${userIds}
      steps:
        - tryStep:
            try:
              steps:
                - get:
                    call: http.get
                    args:
                      url: ${"https://example.com/getUserInfo?userId=" + string(uid)}
                    result: userInfo
                - post:
                    call: http.post
                    args:
                      url: ${"https://example.com/saveUserInfo?userId=" + string(uid)}
                      body: ${userInfo}
            except:
              as: e
              steps:
                - knownErrors:
                    switch:
                      - condition: ${not("HttpError" in e.tags)}
                        return: '${"Connection problem with userID: " + string(uid)}'
                - unhandledErrors:
                    raise: ${e}

다음 단계

다른 Google Cloud 제품의 코드 샘플을 검색하고 필터링하려면 Google Cloud 샘플 브라우저를 참조하세요.