A common type of workflow step uses the call
field to run a function and
return a result:
YAML
- STEP_NAME: call: FUNCTION_NAME args: ARG_1: VALUE_1 ARG_2: VALUE_2 ... result: OUTPUT_VARIABLE
JSON
[ { "STEP_NAME": { "call": "FUNCTION_NAME", "args": { "ARG_1": "VALUE_1", "ARG_2": "VALUE_2" }, "result": "OUTPUT_VARIABLE" } } ]
Replace the following:
FUNCTION_NAME
: the name of the function you are callingARG_1
,ARG_2
(optional): if the function accepts parameters, the arguments you are passing and their values (VALUE_1
,VALUE_2
)OUTPUT_VARIABLE
(optional): if the function returns anything, the variable to store the returned data in
Calls are often HTTP requests but can be made to any function including a connector, a standard library function, or a subworkflow (user-defined function):
- Connectors can be used to connect to other Google Cloud APIs within a workflow, and to integrate your workflows with those products, allowing you to perform operations from other Google Cloud services.
- Standard library functions include modules and frequently used functions, such as for data type and format conversions, as well as functions that make HTTP calls like http.get and http.post. To access HTTP response data saved in a variable, see Make an HTTP request.
- Subworkflows let you define a piece of logic that can be called from the main workflow, similar to a routine or function in a programming language.
Samples
The following samples demonstrate the syntax. For more samples, see Make an HTTP request.
Assign the response from an API call
This sample makes a call to a sample API. The returned day of the week is passed to the Wikipedia API. Relevant articles on Wikipedia about the current day of the week are returned.
YAML
JSON
Make an external HTTP POST request
This sample makes a POST request to an external HTTP endpoint.