Complete the code to define a simple step in a Google Cloud Workflow.
steps:
- sayHello:
call: http.get
args:
url: "https://example.com/api/[1]"
result: responseThe URL path segment should be 'world' to complete the example API call.
Complete the code to specify the workflow's main entry point.
main:
steps:
- firstStep:
call: [1]
args:
url: "https://example.com"
result: outputThe 'http.get' call is used to make an HTTP GET request in a workflow step.
Fix the error in the step that calls a Cloud Function.
steps:
- callFunction:
call: [1]
args:
name: projects/my-project/locations/us-central1/functions/myFunction
result: functionResponseThe correct method to call a Cloud Function in Workflows is 'cloudfunctions.call'.
Fill both blanks to correctly handle a conditional step in the workflow.
steps:
- checkStatus:
switch:
- condition: ${response.status_code == [1]
next: successStep
- condition: ${response.status_code == [2]
next: failureStepStatus code 200 means success, 404 means not found (failure).
Fill all three blanks to correctly define a loop that calls an API for each item.
steps:
- processItems:
for:
value: item
in: [1]
steps:
- callApi:
call: http.post
args:
url: "https://api.example.com/data"
body: $[2]
result: apiResponse
result: responses
- returnResults:
return: [3]The loop iterates over 'itemsList', sends each 'item' in the body, and returns 'responses'.
