Create execution
Endpoint
posthttps://<REGION>.cloud.appwrite.io/v1/functions/{functionId}/executions
Description
Trigger a function execution. The returned object will return you the current execution status. You can ping the Get Execution endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
Required scopes
Authentication
setProject() and ensure the user is signed in. The SDK sends the session header automatically after login.Path
Function ID.
Body
HTTP body of execution. Default value is empty string.
Execute code in the background. Default value is false.
HTTP path of execution. Path can include query params. Default value is /
HTTP method of execution. Default value is POST.
HTTP headers of execution. Defaults to empty.
Scheduled execution time in ISO 8601 format. DateTime value must be in future with precision in minutes.
Execution
Execution ID.
Execution creation date in ISO 8601 format.
Execution update date in ISO 8601 format.
Execution roles.
Function ID.
Function's deployment ID used to create the execution.
The trigger that caused the function to execute. Possible values can be: http, schedule, or event.
The status of the function execution. Possible values can be: waiting, processing, completed, failed, or scheduled.
HTTP request method type.
HTTP request path and query.
HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous.
Object type
HTTP response status code.
HTTP response body. This will return empty unless execution is created as synchronous.
HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous.
Object type
Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
Resource(function/site) execution duration in seconds.
The scheduled time for execution. If left empty, execution will be queued immediately.
import { Client, Functions, ExecutionMethod } from "appwrite";
const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const functions = new Functions(client);
const result = await functions.createExecution({ functionId: '<FUNCTION_ID>', body: '<BODY>', // optional async: false, // optional xpath: '<PATH>', // optional method: ExecutionMethod.GET, // optional headers: {}, // optional scheduledAt: '<SCHEDULED_AT>' // optional});
console.log(result);Functions
executions
Create execution
Endpoint
posthttps://<REGION>.cloud.appwrite.io/v1/functions/{functionId}/executions
Description
Trigger a function execution. The returned object will return you the current execution status. You can ping the Get Execution endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
Required scopes
Authentication
setProject() and ensure the user is signed in. The SDK sends the session header automatically after login.Path
Function ID.
Body
HTTP body of execution. Default value is empty string.
Execute code in the background. Default value is false.
HTTP path of execution. Path can include query params. Default value is /
HTTP method of execution. Default value is POST.
HTTP headers of execution. Defaults to empty.
Scheduled execution time in ISO 8601 format. DateTime value must be in future with precision in minutes.
Execution
Execution ID.
Execution creation date in ISO 8601 format.
Execution update date in ISO 8601 format.
Execution roles.
Function ID.
Function's deployment ID used to create the execution.
The trigger that caused the function to execute. Possible values can be: http, schedule, or event.
The status of the function execution. Possible values can be: waiting, processing, completed, failed, or scheduled.
HTTP request method type.
HTTP request path and query.
HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous.
Object type
HTTP response status code.
HTTP response body. This will return empty unless execution is created as synchronous.
HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous.
Object type
Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
Resource(function/site) execution duration in seconds.
The scheduled time for execution. If left empty, execution will be queued immediately.
import { Client, Functions, ExecutionMethod } from "appwrite";
const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const functions = new Functions(client);
const result = await functions.createExecution({ functionId: '<FUNCTION_ID>', body: '<BODY>', // optional async: false, // optional xpath: '<PATH>', // optional method: ExecutionMethod.GET, // optional headers: {}, // optional scheduledAt: '<SCHEDULED_AT>' // optional});
console.log(result);