Functions

SERVER

The Functions service allows you to create custom behaviour that can be triggered by any supported Appwrite system events or by a predefined schedule.

Appwrite Cloud Functions lets you automatically run backend code in response to events triggered by Appwrite or by setting it to be executed in a predefined schedule. Your code is stored in a secure way on your Appwrite instance and is executed in an isolated environment.

You can learn more by following our Cloud Functions tutorial.

Base URL
https://cloud.appwrite.io/v1

List Functions

Get a list of all the project's functions. You can use the query params to filter your results.

  • Request
    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout

    • search string

      Search term to filter your list results. Max length: 256 chars.

  • Response
Endpoint
GET /functions
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.list(
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Create Function

Create a new function. You can pass a list of permissions to allow different project users or team with access to execute the function using the client API.

  • Request
    • functionId string
      required

      Function ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.

    • name string
      required

      Function name. Max length: 128 chars.

    • execute array
      required

      An array of strings with execution roles. By default no user is granted with any execute permissions. learn more about permissions. Maximum of 100 roles are allowed, each 64 characters long.

    • runtime string
      required

      Execution runtime.

    • events array

      Events list. Maximum of 100 events are allowed.

    • schedule string

      Schedule CRON syntax.

    • timeout integer

      Function maximum execution time in seconds.

    • enabled boolean

      Is function enabled?

  • Response
Endpoint
POST /functions
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.create(
        functionId = "[FUNCTION_ID]",
        name = "[NAME]",
        execute = listOf("any"),
        runtime = "node-14.5",
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

List runtimes

Get a list of all runtimes that are currently active on your instance.

Endpoint
GET /functions/runtimes
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.listRuntimes(new Continuation<Response>() {
        @NotNull
        @Override
        public CoroutineContext getContext() {
            return EmptyCoroutineContext.INSTANCE;
        }

        @Override
        public void resumeWith(@NotNull Object o) {
            String json = "";
            try {
                if (o instanceof Result.Failure) {
                    Result.Failure failure = (Result.Failure) o;
                    throw failure.exception;
                } else {
                    Response response = (Response) o;
                }
            } catch (Throwable th) {
                Log.e("ERROR", th.toString());
            }
        }
    });
}

Get Function

Get a function by its unique ID.

  • Request
    • functionId string
      required

      Function ID.

  • Response
Endpoint
GET /functions/{functionId}
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.get(
        functionId = "[FUNCTION_ID]"
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Update Function

Update function by its unique ID.

  • Request
    • functionId string
      required

      Function ID.

    • name string
      required

      Function name. Max length: 128 chars.

    • execute array
      required

      An array of strings with execution roles. By default no user is granted with any execute permissions. learn more about permissions. Maximum of 100 roles are allowed, each 64 characters long.

    • events array

      Events list. Maximum of 100 events are allowed.

    • schedule string

      Schedule CRON syntax.

    • timeout integer

      Maximum execution time in seconds.

    • enabled boolean

      Is function enabled?

  • Response
Endpoint
PUT /functions/{functionId}
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.update(
        functionId = "[FUNCTION_ID]",
        name = "[NAME]",
        execute = listOf("any"),
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Delete Function

Delete a function by its unique ID.

  • Request
    • functionId string
      required

      Function ID.

  • Response
    • 204 application/json
Endpoint
DELETE /functions/{functionId}
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.delete(
        functionId = "[FUNCTION_ID]"
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

List Deployments

Get a list of all the project's code deployments. You can use the query params to filter your results.

  • Request
    • functionId string
      required

      Function ID.

    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: entrypoint, size, buildId, activate

    • search string

      Search term to filter your list results. Max length: 256 chars.

  • Response
Endpoint
GET /functions/{functionId}/deployments
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.listDeployments(
        functionId = "[FUNCTION_ID]",
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Create Deployment

Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID.

This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the Appwrite Cloud Functions tutorial.

Use the "command" param to set the entry point used to execute your code.

  • Request
    • functionId string
      required

      Function ID.

    • entrypoint string
      required

      Entrypoint File.

    • code string
      required

      Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.

    • activate boolean
      required

      Automatically activate the deployment when it is finished building.

  • Response
Endpoint
POST /functions/{functionId}/deployments
Java
import io.appwrite.Client
import io.appwrite.models.InputFile
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.createDeployment(
        functionId = "[FUNCTION_ID]",
        entrypoint = "[ENTRYPOINT]",
        code = InputFile.fromPath("file.png"),
        activate = false
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Get Deployment

Get a code deployment by its unique ID.

  • Request
    • functionId string
      required

      Function ID.

    • deploymentId string
      required

      Deployment ID.

  • Response
Endpoint
GET /functions/{functionId}/deployments/{deploymentId}
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.getDeployment(
        functionId = "[FUNCTION_ID]",
        deploymentId = "[DEPLOYMENT_ID]"
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Update Function Deployment

Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint.

  • Request
    • functionId string
      required

      Function ID.

    • deploymentId string
      required

      Deployment ID.

  • Response
Endpoint
PATCH /functions/{functionId}/deployments/{deploymentId}
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.updateDeployment(
        functionId = "[FUNCTION_ID]",
        deploymentId = "[DEPLOYMENT_ID]"
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Delete Deployment

Delete a code deployment by its unique ID.

  • Request
    • functionId string
      required

      Function ID.

    • deploymentId string
      required

      Deployment ID.

  • Response
    • 204 application/json
Endpoint
DELETE /functions/{functionId}/deployments/{deploymentId}
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.deleteDeployment(
        functionId = "[FUNCTION_ID]",
        deploymentId = "[DEPLOYMENT_ID]"
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

List Executions

Get a list of all the current user function execution logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. Learn more about different API modes.

  • Request
    • functionId string
      required

      Function ID.

    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, statusCode, duration

    • search string

      Search term to filter your list results. Max length: 256 chars.

  • Response
Endpoint
GET /functions/{functionId}/executions
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.listExecutions(
        functionId = "[FUNCTION_ID]",
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Create Execution

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.

  • Request
    • functionId string
      required

      Function ID.

    • data string

      String of custom data to send to function.

    • async boolean

      Execute code in the background. Default value is false.

  • Response
  • Rate limits

    This endpoint is not limited when using Server SDKs with API keys. If you are using SSR with setSession, these rate limits will still apply. Learn more about SSR rate limits.

    The limit is applied for each unique limit key.

    Time frame
    Attempts
    Key
    1 minutes 60 requests IP + USER ID
Endpoint
POST /functions/{functionId}/executions
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.createExecution(
        functionId = "[FUNCTION_ID]",
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Get Execution

Get a function execution log by its unique ID.

  • Request
    • functionId string
      required

      Function ID.

    • executionId string
      required

      Execution ID.

  • Response
Endpoint
GET /functions/{functionId}/executions/{executionId}
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.getExecution(
        functionId = "[FUNCTION_ID]",
        executionId = "[EXECUTION_ID]"
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

List Variables

Get a list of all variables of a specific function.

  • Request
    • functionId string
      required

      Function unique ID.

  • Response
Endpoint
GET /functions/{functionId}/variables
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.listVariables(
        functionId = "[FUNCTION_ID]"
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Create Variable

Create a new function variable. These variables can be accessed within function in the env object under the request variable.

  • Request
    • functionId string
      required

      Function unique ID.

    • key string
      required

      Variable key. Max length: 255 chars.

    • value string
      required

      Variable value. Max length: 8192 chars.

  • Response
Endpoint
POST /functions/{functionId}/variables
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.createVariable(
        functionId = "[FUNCTION_ID]",
        key = "[KEY]",
        value = "[VALUE]"
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Get Variable

Get a variable by its unique ID.

  • Request
    • functionId string
      required

      Function unique ID.

    • variableId string
      required

      Variable unique ID.

  • Response
Endpoint
GET /functions/{functionId}/variables/{variableId}
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.getVariable(
        functionId = "[FUNCTION_ID]",
        variableId = "[VARIABLE_ID]"
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Update Variable

Update variable by its unique ID.

  • Request
    • functionId string
      required

      Function unique ID.

    • variableId string
      required

      Variable unique ID.

    • key string
      required

      Variable key. Max length: 255 chars.

    • value string

      Variable value. Max length: 8192 chars.

  • Response
Endpoint
PUT /functions/{functionId}/variables/{variableId}
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.updateVariable(
        functionId = "[FUNCTION_ID]",
        variableId = "[VARIABLE_ID]",
        key = "[KEY]",
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}

Delete Variable

Delete a variable by its unique ID.

  • Request
    • functionId string
      required

      Function unique ID.

    • variableId string
      required

      Variable unique ID.

  • Response
    • 204 application/json
Endpoint
DELETE /functions/{functionId}/variables/{variableId}
Java
import io.appwrite.Client
import io.appwrite.services.Functions

public void main() {
    Client client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

    Functions functions = new Functions(client);
    functions.deleteVariable(
        functionId = "[FUNCTION_ID]",
        variableId = "[VARIABLE_ID]"
        new Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }

            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        }
    );
}