call_endpoint
Calls a named endpoint on a connection's adaptor and returns the result. This allows you to make API requests to external systems directly from within a formula expression.
Syntax
call_endpoint(connection, endpoint_name, variable_dict)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| connection | Connection | Yes | The connection instance to use for the API request. |
| endpoint_name | string | Yes | The name of the endpoint defined on the connection's adaptor. |
| variable_dict | dict | No | A dictionary of variable names and values to pass to the endpoint. Defaults to an empty dictionary. |
Returns
Type: Future
A future that resolves to the response from the endpoint request.
Examples
Calling an endpoint with no variables:
call_endpoint($my_connection, "get_users")
Calls the "get_users" endpoint on the adaptor associated with $my_connection.
Calling an endpoint with variables:
call_endpoint($my_connection, "get_user_by_id", {"user_id": [sys_id]})
Calls the "get_user_by_id" endpoint, passing the current record's sys_id field as the user_id variable.
Using variables from multiple fields:
call_endpoint($target_connection, "create_record", {"title": [short_description], "priority": [priority]})
Passes multiple field values as variables to the endpoint.
Notes
- The
connectionparameter must be a valid connection instance with an adaptor that defines the specified endpoint. - If the endpoint name does not exist on the adaptor, an error will be raised.
- The
variable_dictkeys must match the variable names expected by the endpoint definition. - This function executes asynchronously and returns a future object.
Comments
0 comments
Please sign in to leave a comment.