# FuncApi (Function APIs)

## executeFunction

Execute a specific Trillo function by providing its parameters.​

```
FuncApi.executeFunction(functionName, params)

or

FuncApi.executeFunction(appName, functionName, params)
```

parameters:

```
functionName: name of the function as str
params:   dictionary representing the parameters
appName: str
```

**Sample Code**

```python
functionParameters = {}
result = FuncApi.executeFunction("FUNCTION_NAME", functionParameters)
```

**Returns**:

```
Dictionary containing the result of the function execution.
```

## executeFunctionWithMethod

Executes a function with a specific method and parameters.

```
FuncApi.executeFunctionWithMethod(functionName, methodName, params)

or

FuncApi.executeFunctionWithMethod(appName, functionName, methodName, params)
```

#### Parameters

```
functionName: str
methodName: str
params: dictionary
appName: str
```

**Sample Code**

<pre class="language-python"><code class="lang-python">functionParameters = {}
<strong>result = FuncApi.executeFunctionWithMethod("FUNCTION_NAME", "METHOD_NAME", functionParameters)
</strong>
</code></pre>

**Returns**

```
Dictionary containing the result of the function execution with method.
```

## executeSSH

Execute a remote ssh command on a server whose keys are known to the workbench.​ Generally the SSH server is a companion server of the workbench.

```
FuncApi.executeSSH(hostName, command)

or

FuncApi.executeSSH(hostName, command, async)

or

FuncApi.executeSSH(command, async)
```

parameters:

```
hostName: the str name of the companion server
command:   the command needed to be executed as str
async:     execute command immediately and wait or run it in the background
```

**Returns**:

```
Dictionary containing the result of the SSH command execution.
```

## pingTask

Ping an asynchronous task by id​ and returns it's last time stamp

```
FuncApi.pingTask(id)
```

parameters:

```
id: task name (str)
```

**Sample Code**

<pre class="language-python"><code class="lang-python"><strong>result = FuncApi.pingTask("id");
</strong></code></pre>

**Returns**:

```
Dictionary containing the result of the ping operation.
```

## createTask

Creates a task for a function.

```
FuncApi.createTask(taskName, taskType, functionName, params)

or

FuncApi.createTask(taskName, taskType, appName, functionName, params)
```

#### Parameters

```
taskName: str
taskType: str
functionName: str
params: dictionary
appName: str
```

**Sample Code**

<pre class="language-python"><code class="lang-python"><strong>result = FuncApi.pingTask("id")
</strong></code></pre>

**Returns**

```
Dictionary containing the result of the task creation.
```

## createTaskBySourceUid

Creates a task for a function using source UID.

```
FuncApi.createTaskBySourceUid(taskName, taskType, sourceUid, functionName, params)

or

FuncApi.createTaskBySourceUid(taskName, taskType, sourceUid, appName, functionName, params)
```

#### Parameters

```
taskName: str
taskType: str
sourceUid: str
functionName: str
params: dictionary
appName: str
```

**Sample Code**

<pre class="language-python"><code class="lang-python"><strong>functionParameters = {}
</strong><strong>result = FuncApi.createTaskBySourceUid("upsertTask", "CURD", "Job1123", "FUNCTION_NAME", functionParameters)
</strong><strong>
</strong></code></pre>

**Returns**

```
Dictionary containing the result of the task creation.
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trillo.gitbook.io/trillo-workbench-python-sdk/serverless-function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
