Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a simple step in a Google Cloud Workflow.
GCP
steps:
- sayHello:
call: http.get
args:
url: "https://example.com/api/[1]"
result: response Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated words that do not fit the URL path.
✗ Incorrect
The URL path segment should be 'world' to complete the example API call.
2fill in blank
mediumComplete the code to specify the workflow's main entry point.
GCP
main:
steps:
- firstStep:
call: [1]
args:
url: "https://example.com"
result: output Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using custom function names instead of built-in calls.
✗ Incorrect
The 'http.get' call is used to make an HTTP GET request in a workflow step.
3fill in blank
hardFix the error in the step that calls a Cloud Function.
GCP
steps:
- callFunction:
call: [1]
args:
name: projects/my-project/locations/us-central1/functions/myFunction
result: functionResponse Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names that do not exist.
✗ Incorrect
The correct method to call a Cloud Function in Workflows is 'cloudfunctions.call'.
4fill in blank
hardFill both blanks to correctly handle a conditional step in the workflow.
GCP
steps:
- checkStatus:
switch:
- condition: ${response.status_code == [1]
next: successStep
- condition: ${response.status_code == [2]
next: failureStep Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing status codes or using non-standard codes.
✗ Incorrect
Status code 200 means success, 404 means not found (failure).
5fill in blank
hardFill all three blanks to correctly define a loop that calls an API for each item.
GCP
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] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names or returning undefined variables.
✗ Incorrect
The loop iterates over 'itemsList', sends each 'item' in the body, and returns 'responses'.