Call function
- async AsyncCogniteClient.functions.call(
- id: int | None = None,
- external_id: str | None = None,
- data: dict[str, object] | None = None,
- wait: bool = True,
- nonce: str | None = None,
Call a function by its ID or external ID.
- Parameters:
id (int | None) – ID
external_id (str | None) – External ID
data (dict[str, object] | None) – Input data to the function (JSON serializable). This data is passed deserialized into the function through one of the arguments called data. WARNING: Secrets or other confidential information should not be passed via this argument. There is a dedicated secrets argument in FunctionsAPI.create() for this purpose.’
wait (bool) – Wait until the function call is finished. Defaults to True.
nonce (str | None) – Nonce retrieved from sessions API when creating a session. This will be used to bind the session before executing the function. If not provided, a new session will be created based on the client credentials.
Tip
You can create a session via the Sessions API, using the client.iam.session.create() method.
- Returns:
A function call object.
- Return type:
Examples
Call a function by id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> call = client.functions.call(id=1)
Call a function directly on the Function object:
>>> func = client.functions.retrieve(id=1) >>> call = func.call()